Skip to content

Instantly share code, notes, and snippets.

@AVJdataminer
Last active April 14, 2019 14:11
Show Gist options
  • Save AVJdataminer/8652d764456b36689938fb22a1ed357d to your computer and use it in GitHub Desktop.
Save AVJdataminer/8652d764456b36689938fb22a1ed357d to your computer and use it in GitHub Desktop.
time to day of year
import datetime
def time_stamp(df,time_col):
df[time_col] = pd.to_datetime(df[time_col])
df["year"] = df[time_col].dt.year
df["month"] = df[time_col].dt.month
df["day"] = df[time_col].dt.day
df['day_of_yr']=df[time_col].dt.strftime('%j').astype(int)
time_stamp(df,"Latest Launch")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment