When trying to save some number as a string type in CSV file, then saving this file and reading it again, the file shows this saved data as a numpy.int64 instead of a string. How can this be solved so when reading the csv file it reads it as a string, not int?
Here is a Python script that describes this case
import pandas as pd
df = pd.DataFrame(columns=['ID'])
ID = '1'
df = df.append(pd.DataFrame([[ID]], columns=['ID']))
df.to_csv('test.csv', index=False)
"""
now the csv file looks like this:
ID
1
"""
df = pd.read_csv('test.csv')
print(df['ID'].iloc[0] == ID) # this will print False
print(type(df['ID'].iloc[0])) # this will print <class 'numpy.int64'>