Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas change to first day

df['day'] = df['day'].map(lambda x: pd.datetime(x.year, x.month, 1))
print (df)
         day
0 2016-07-01
1 2016-08-01
2 2016-09-01
3 2016-10-01
4 2016-11-01
Comment

PREVIOUS NEXT
Code Example
Python :: pygame.rect 
Python :: python write list to excel file 
Python :: read excel into dataframe python 
Python :: endswith python 
Python :: pyspark left join 
Python :: fillna with mode pandas 
Python :: python print numbers 1 to 10 in one line 
Python :: python numpy vstack 
Python :: python convert string to sentence case 
Python :: how to find 1 st digit in python 
Python :: convert array to set python 
Python :: python swap two values in list 
Python :: python glob 
Python :: create list of numbers 
Python :: python check for duplicate 
Python :: python square all numbers in list 
Python :: smtplib send pdf 
Python :: python notebook breakpoints 
Python :: live plot loss 
Python :: Iterating With for Loops in Python Using range() and len() 
Python :: django month name from month number 
Python :: how to add two matrix using function in python 
Python :: selenium get parent element 
Python :: create dictionary from keys and values python 
Python :: python dict append 
Python :: imread real color cv2 
Python :: python f string 
Python :: python vs c++ 
Python :: pil normalize image 
Python :: esp8266 micropython ds18b20 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =