Skip to content

Commit

Permalink
fix output index datetime to date
Browse files Browse the repository at this point in the history
  • Loading branch information
backmind committed Jan 25, 2022
1 parent efdedab commit 4a58b4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions RICE192out.py
Expand Up @@ -94,7 +94,7 @@ def process_pesticide_mass(sim_name="", delete_file=True, save_file=False):


df = pd.read_csv(StringIO(out_file), header=[0])
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True)
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True).date
if save_file:
df.to_excel("bin\\"+sim_name+".xlsx")
if delete_file:
Expand Down Expand Up @@ -127,7 +127,7 @@ def process_paddy_outflow(sim_name="", delete_file=True, save_file=False):
out_file = out_file[:-1]

df = pd.read_csv(StringIO(out_file), header=[0])
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True)
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True).date
if save_file:
df.to_excel("bin\\"+sim_name+".xlsx")
if delete_file:
Expand Down Expand Up @@ -157,7 +157,7 @@ def process_water_balance(sim_name="", delete_file=True, save_file=False):
out_file = out_file[:-1]

df = pd.read_csv(StringIO(out_file), header=[0])
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True)
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True).date
if save_file:
df.to_excel("bin\\"+sim_name+".xlsx")
if delete_file:
Expand Down Expand Up @@ -211,7 +211,7 @@ def process_pesticide_balance(file_name, sim_name="", delete_file=True, save_fil
out_file = out_file[:-1]

df = pd.read_csv(StringIO(out_file), header=[0])
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True)
df.index = pd.to_datetime(df.index,dayfirst=True,format="%d-%m-%y",infer_datetime_format=True).date
if save_file:
df.to_excel("bin\\"+sim_name+".xlsx")
if delete_file:
Expand Down

0 comments on commit 4a58b4b

Please sign in to comment.