Reputation: 772
With the help of the following code I can define day of the week
out of epoch:
epoch = 4464769126
day = time.strftime('%A', time.localtime(epoch))
print(day)
Friday
I have applied it to the column in df.epoch
with the for loop, but it is time consuming. Any ideas how to speed up the process?
Upvotes: 0
Views: 114
Reputation: 5461
you do this using pandas to_datetime function like below
import pandas as pd
df = pd.DataFrame({"epoch": ["4464769126"]})
pd.to_datetime(df["epoch"], unit="s").dt.weekday_name
Upvotes: 1