Home > Mobile >  Problems filtering xlsx and csv data with pandas
Problems filtering xlsx and csv data with pandas

Time:12-02

I have a problem regarding how to filter xlsx and csv data points with pandas.

import pandas as pd
df = pd.read_excel("Wind.xlsx")
df.head()
filter = df[["WindSpeed"] > 2]
ew=df[filter]
print(ew)
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

How come it will not return the value greater than 2?

The result is an error which is the following: TypeError: '>' not supported between instances of 'list' and 'int'

CodePudding user response:

Use

filter = df["WindSpeed"] > 2

CodePudding user response:

Try this

filter = df[df['WindSpeed'] > 2]
  • Related