2014-02-25 116 views
1

當我使用下面的代碼:如何基於條件來分割熊貓數據框?

frioMurteira = data.loc[(data["POM"] == "Murteira" & data["TMP"] > 7.2), ["DTM","TMP"]] 

我得到以下錯誤:

cannot compare a dtyped [float64] array with a scalar of type [bool] 

你能幫助我嗎?

謝謝

回答

3

我覺得這是你的括號錯誤,試試這個:

frioMurteira = data.loc[(data["POM"] == "Murteira") & (data["TMP"] > 7.2), ["DTM","TMP"]]