Laur's blog
Sign in Subscribe

dataframe

A collection of 2 posts
Convert Timestamp to DateTime for Pandas DataFrame
dataframe

Convert Timestamp to DateTime for Pandas DataFrame

To convert a pandas data frame value from unix timestamp to python datetime you need to use: pd.to_datetime(df['timestamp'], unit='s') where: * timestamp is the column containing the timestamp value * unit='s' defines the unit of the timestamp (seconds in this
Aug 8, 2017 1 min read
Save Pandas DataFrame as Django Model
convert

Save Pandas DataFrame as Django Model

TL;DR: use bulk_upload coupled with a comprehension to speed up loading. Initially, I started to convert the data frame to a Model object row by row and save it. While easy, it's also arguably the slowest method to load records, because the save() call performs a
Aug 7, 2017 2 min read
Page 1 of 1
Laur's blog © 2025
  • Sign up
Powered by Ghost