Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python: calculate number of days from today date in a data frame

df[['A','B']] = df[['A','B']].apply(pd.to_datetime) # If conversion required
df['C'] = (df['B'] - df['A']).dt.days
Comment

PREVIOUS NEXT
Code Example
Python :: set title matplotlib 
Python :: python datetime to seconds 
Python :: second y axis matplotlib 
Python :: how to print time python 
Python :: datetime.datetime.fromtimestamp() 
Python :: modify string in column pandas 
Python :: change directory in python script 
Python :: django ckeditor not working 
Python :: normal distribution in python 
Python :: django permission required 
Python :: group by but keep all columns pandas 
Python :: finding the Unique values in data 
Python :: all letters an numbers py array 
Python :: train_size 
Python :: inline if python 
Python :: pipenv with specific python version 
Python :: pandas add list to dataframe as column 
Python :: numpy item size 
Python :: how to sum only the even values in python 
Python :: tkinter yes no dialogue box 
Python :: separate path python 
Python :: pickle load pickle file 
Python :: named tuple python iterate 
Python :: python print percent sign 
Python :: sort by multiple keys in object python 
Python :: change size of plot python 
Python :: pyspark split dataframe by rows 
Python :: python pillow resize image 
Python :: django static files / templates 
Python :: python delete dict key if exists 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =