Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert timedelta to days

# Convert TimeDelta column (5 days etc.) into an integer column (5)
import numpy as np
df.timeDelta = (df.timeDelta / np.timedelta64(1,'D')).astype(int)
Comment

convert timedelta to days

# Convert TimeDelta column (5 days etc.) into an integer column (5)
import numpy as np
df['timeDelta'] = (df['timeDelta'] / np.timedelta64(1,'D')).astype(int)
Comment

PREVIOUS NEXT
Code Example
Python :: compare dates python 
Python :: python cache 
Python :: python trim whitespace from end of string 
Python :: print from within funciton with multiprocessing 
Python :: buttons on canvas tkinter 
Python :: Python NumPy copyto function example 
Python :: how return the data timestamp after some days in python 
Python :: get last 3 things in a list python 
Python :: python sockets 
Python :: access list items in python 
Python :: get keys from dictionary python 
Python :: pandas rename column by dictionary 
Python :: how to concatenate dataframe in python 
Python :: convert plt image to numpy 
Python :: group by 2 unique attributes pandas 
Python :: reading binary file 
Python :: pandas -inf and inf to 0 
Python :: feature selection python 
Python :: how to change index in dataframe python 
Python :: write cell output to file jupyter colab 
Python :: sha256 decrypt python 
Python :: Python Tkinter Message Widget 
Python :: update ubuntu to python 3.85 
Python :: area of trapezium 
Python :: remove specific character from object in pandas column using iloc 
Python :: list to dict python with same values 
Python :: pandas add value to excel column and save 
Python :: how to convert csv into list 
Python :: convert tensor to numpy array 
Python :: python compiler to exe 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =