I queried my postgres database to retrieve information from a table:
SQLResults = cursor.execute('SELECT x.some_12_long_integer from test as x;')
Now when I run this query in database, I get 1272140958198
, but when I dump this in a dataframe:
The x.some_12_long_integer
is int8.
I am using xlsxwriter:
excel_writer = ExcelWriter(
self.fullFilePath, engine="xlsxwriter",
engine_kwargs={'options': {'strings_to_numbers': True}}
)
frame = DataFrame(SQLResults[0])
frame.to_excel(excel_writer, sheet_name="Sheet1", index=False)
When it is converted to Excel it produces 1.27214E+12
but when I format the cell in the Excel file I get 1272140958198
.
How can I make it just stay as 1272140958198
instead of 1.27214E+12
?