Luigi commited on
Commit
87357ad
·
1 Parent(s): 635e75f

Bugfix: prevent Excel from turning your 4e2 into 4.00E+02

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -4,6 +4,7 @@ import numpy as np
4
  from sklearn.preprocessing import PolynomialFeatures
5
  import statsmodels.api as sm
6
  import scipy.optimize as opt
 
7
 
8
  # Global state
9
  data_df = None
@@ -70,7 +71,10 @@ def export_csv():
70
  if data_df is None:
71
  return gr.update(visible=False, value=None)
72
  path = "training_data.csv"
73
- data_df.to_csv(path, index=False)
 
 
 
74
  return gr.update(visible=True, value=path)
75
 
76
  # Panel 2: Train Hierarchical Quadratic RSM
 
4
  from sklearn.preprocessing import PolynomialFeatures
5
  import statsmodels.api as sm
6
  import scipy.optimize as opt
7
+ import csv
8
 
9
  # Global state
10
  data_df = None
 
71
  if data_df is None:
72
  return gr.update(visible=False, value=None)
73
  path = "training_data.csv"
74
+ # wrap every field in double-quotes so Excel won’t re-interpret it
75
+ data_df.to_csv(path, index=False,
76
+ quoting=csv.QUOTE_ALL,
77
+ escapechar='\\')
78
  return gr.update(visible=True, value=path)
79
 
80
  # Panel 2: Train Hierarchical Quadratic RSM