0

I have a data frame like the following:

 LAT LON YEAR MO DY PREC T_MAX T_MIN WS 30.75 76.25 1981 1 3 5.40 22.08 11.22 3.95 30.75 76.75 1981 1 3 3.94 19.25 9.29 3.69 30.75 77.25 1981 1 3 3.28 14.25 6.29 2.87 30.75 77.75 1981 1 3 2.96 10.57 3.23 2.10 30.75 78.25 1981 1 3 2.78 7.62 -0.41 1.51 30.75 78.75 1981 1 3 2.77 1.02 -6.66 1.22 30.75 79.25 1981 1 3 2.47 -3.92 -12.18 1.74 31.25 76.25 1981 1 3 5.97 20.72 10.59 3.77 31.25 76.75 1981 1 3 4.17 15.05 6.70 3.22 31.25 77.25 1981 1 3 3.64 7.47 1.62 2.31 

I need to extract the rows which have lat=30.75 and lon 76.25, for that I used:

data.where(data.LAT==30.75 & data.LON==76.25) 

But this is showing this error:

cannot compare a dtyped [float64] array with a scalar of type [bool] 
1
  • 1
    df[((df.LAT==30.75) & (df.LON==76.25))] this would work Commented Feb 28, 2019 at 8:52

1 Answer 1

1

You don't need where:

data[(data.LAT==30.75) & (data.LON==76.25)] LAT LON YEAR MO DY PREC T_MAX T_MIN WS 0 30.75 76.25 1981 1 3 5.4 22.08 11.22 3.95 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.