Q:

extract first day of month in dataframe

I want to extract the first day of month in a DF. But sometimes the first day is 2nd or 3th. For example
2006-01-01  2775.0  2825.0  2700.0  2725.0  10727600      
2006-01-02  2725.0  2750.0  2675.0  2675.0   2850000      
...
2006-03-03  2700.0  2825.0  2700.0  2825.0   4797600      
2006-03-04  2850.0  2900.0  2825.0  2900.0   5519200      
2006-03-05  2700.0  2825.0  2700.0  2825.0   4797600      
...
2006-04-02  2850.0  2900.0  2825.0  2900.0   5519200 
2006-04-03  1850.0  2900.0  2825.0  2900.0   5513100 

A:

Assumed you date columns name as date
#df.date=pd.to_datetime(df.date)
df=df[~df.date.dt.strftime('%Y-%m').duplicated()].copy()

