I am quite new to programming and I wanted to know if you could help me. I have a file that contains daily precipitation data from 2000 to 2020. I think with pandas I could create a dataframe that contains only the values of the month of January but I can't understand how. Or maybe with CDO create a new file that only contains those values. Could someone help me I would appreciate it
CodePudding user response:
Steps -
- Add a month column to your dataframe
df['month']= pd.to_datetime(df['date']).dt.month
- Select the rows you want using the condition df.month == 1
df[(df['month'] == 1)]
CodePudding user response:
I have this dataframe but i can´t add a month column