Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas remove time from datetime

In [37]:

df = pd.DataFrame({'date':['2015-02-21 12:08:51']})
df
Out[37]:
                  date
0  2015-02-21 12:08:51
In [39]:

df['date'] = pd.to_datetime(df['date']).dt.date
df
Out[39]:
         date
0  2015-02-21
Comment

pandas remove time from date

# If opening_date is currently a timestamp: 2021-01-09 00:00:00
opening_date = pd.to_datetime(opening_date).date()
print(opening_date) 

# Result: 2021-01-09
Comment

pandas remove time from datetime

#Remove time from datetime object by:
df["Date"] = df["Date"].dt.date
Comment

PREVIOUS NEXT
Code Example
Python :: df.drop index 
Python :: how to use rmse as loss function in keras 
Python :: python sendmessage whatsapp 
Python :: Install requests-html library in python 
Python :: unimport library python 
Python :: python install required packages 
Python :: yield godot 
Python :: beautifulsoup find by class 
Python :: correlation matrix python 
Python :: how to check opencv version using python 
Python :: generate a list of random numbers python 
Python :: discord.py commands not working 
Python :: install python3 centos 7.8 
Python :: python str replace specifiek index 
Python :: python check if port in use 
Python :: transpose a matrix using list comprehension 
Python :: matplotlib change font 
Python :: add all string elements in list python 
Python :: matplotlib grid in background 
Python :: kivy fixed window 
Python :: how to get all links text from a website python beautifulsoup 
Python :: how to update sklearn using conda 
Python :: pandas to list 
Python :: python cmd colors 
Python :: how to convert month to number in python 
Python :: selenium page down key python 
Python :: how to maker loops coun t in second in pytho 
Python :: how to write to an output file in pytion 
Python :: jupyter read in csv 
Python :: required validator python WTForms 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =