daily pastebin goal
94%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. df_merge.assign(newtime = pd.to_datetime(df_merge.time).dt.time)
  2.      
  3. df_merge = pd.DataFrame()
  4. for f in os.listdir(path):
  5.     try:
  6.         df = pd.read_excel(path+"/"+f, header = None, skiprows = 1,
  7.                         names = ['sys_name','sys_no', 'date','time',
  8.                                     'location','collected_by','date_set','date_comp',
  9.                                     'smpl_type','total','fecal','cl_res','comment','lab_no'],
  10.                         dtype = {'time':str})
  11.         if len(df.columns) != 14:
  12.             print(f, "is not formatted properly. It has", len(df.columns), "row(s) when it should have 14.")
  13.         else:
  14.             df_merge = df_merge.append(df, ignore_index=True)
  15.     except Exception as e:
  16.         print(e)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top