problem description
I read the difference data from two different excel, and then put them into a new excel. It is normal to display a column of ID number under IDE, but it becomes a scientific counting method in excel. Is there a way to make a column of ID number directly to excel display is in plain text format?
the environmental background of the problems and what methods you have tried
looked for information on the Internet for a while, but it didn"t work with .astype (int64).
related codes
/ / Please paste the code text below (do not replace the code with pictures)
import pandas as pd
import numpy as np
np.set_printoptions (suppress=True)
df1 = pd.read_excel ("A.xlsx")-sharp Table A basic data-Matrix
df2 = pd.read_excel (" B.xlsx")-sharp Table B basic data
a = df2 [(df2 ["ID number"]! = df1 ["ID number"]) & (df1 ["name"] = = df2 ["name"])
b = df2 [(df2 ["ID number") ] = df1 ["ID number"] .astype ("str")) & (df1 [" name"]! = df2 ["name"])
X = [a, b]
Z = pd.concat (X)
print (Z)
writer = pd.ExcelWriter ("difference .xlsx")
a.to_excel (writer, "sheet1")
b.to_excel (writer," sheet2")
writer.save ()
what result do you expect? What is the error message actually seen?
the expected result is that a normal ID number is generated in excel. In fact, not only does it not generate a normal ID number, but the number is also wrong. The last four became 0000
.