Files
Python-for-Geeks/Chapter6/mypandas/advance/pandastrick3.py
T
2021-03-13 19:25:45 +04:00

13 lines
445 B
Python

# pandastrick3.py
import pandas as pd
weekly_data = {'day':['Monday','Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday'],
'temp':[40, 33, 42, 31, 41, 40, 30],
'condition':['Sunny','Cloudy','Sunny','Rainy','Sunny',
'Cloudy','Rainy']
}
df = pd.DataFrame(weekly_data)
print(df[(df.temp >= 30) & (df.temp<=40)])
print(df[df.temp.between(30,40)])