I have an Excel spreadsheet (an extract from SAP). I turn this into a DataFrame, do calculations and save it to an SQLite database. The Excel spreadsheet has comma as decimal separator. The SQLite database uses a dot as decimal separator.
Extract from the code:
df_mce3 = pd.read_excel('rawdata/filename.xlsx', header=0, converters={'supplier': str, 'month': str}, decimal=',')
decimal=','
only works with CSV files. I use following code to save the results to an SQLite database:
conn = sqlite.connect("database.db")
df_mce3.to_sql("rawdata", conn, if_exists="replace")
df_ka_ext.to_sql("costanalysis_external", conn, if_exists="replace")
[...]
Input:
month ordqty ordprice ordervolume invoiceqty invoiceprice
08.2017 10,000 14,90 149,00 10,000 14,90
Output:
month ordqty ordprice ordervolume invoiceqty invoiceprice
08.2017 10.000 14.90 149.00 10.000 14.90
I need those numbers to have the same decimal separator as the input data and I cannot find a way to do this. I am using Python 3.5 with Pandas 0.19.1 and NumPy 1.11.2 on Mac OS X.