Last active
December 22, 2021 22:36
-
-
Save tashrifbillah/cea43521588adf127cae79353ae09968 to your computer and use it in GitHub Desktop.
Make DPdash compatible files from flow check CSVs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pandas as pd | |
import sys | |
from os.path import abspath | |
filename= abspath(sys.argv[1]) | |
# read Kevin's dataframe | |
df= pd.read_csv(filename) | |
# replace [Date,Time,UTC Offset] columns with [day,reftime,timeofday,weekday] | |
dfnew= pd.DataFrame(columns=['day','reftime','timeofday','weekday']+list(df.columns.values[3:])) | |
# insert values | |
dfnew.loc[0]= list([1,'','',''])+ list(df.loc[0][3:].values) | |
outfile= filename.split('flowcheck')[0]+ 'flowcheck-'+ 'day1to1.csv' | |
dfnew.to_csv(outfile, index=False) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment