pandas solves excel scientific notation problem
excel default processing over 14 digits into scientific notation, and the number after the default change to 0.
This is the nastiest problem when using pandas to combine tables or generate new ones.
I've personally tested two methods that work
1, if the amount of data is not large, you can replace to_excel with to_csv, csv is still extremely inclusive, but when the amount of data is huge, you will encounter a situation that can not be opened.
2, universal solution, read_excel when:
df = pd.read_excel("filepath", dtype=str)
With a uniform str type, there is no such thing as a number that is not a number.
But be warned:
df = df.infer_objects() """ """ df.to_excel("filepath", index=False, encoding="utf-8")
pandas replaces scientific notation numbers
When reading data in Pandas, I found that work order numbers, phone numbers, etc. are recorded in scientific notation. I observed that scientific notation is used when the phone number type is float, but not int. Convert the phone number to an int type (in Excel, converting the phone number to a string type did not solve the problem).
The first step is to convert the null value to a numeric value, here I converted it to -1 (here I filled all the fields of data with -1)
data = (-1)
Convert the phone number field to an int type (I converted all the numbers that needed an int type. Note: containing a null value will report an error about not being able to convert NA to Integer)
data[['Contact number','Associated Work Orders','Processors','Processing satisfaction']].astype('int64')
The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.