[英]Python Pandas read_csv float64 to string
I'm reading below CSV file as read_csv我正在阅读下面的 CSV 文件作为read_csv
day,order,variant,variant_name
2020-05-04,OR_001,1000000548952,Product1
2020-05-04,OR_001,1000000056488,Product4
2020-05-04,OR_002,1000000528985,Product2
When I read this in a dataframe and then print the variant column当我在 dataframe 中阅读此内容然后打印变体列时
print(df_SalesOrders["variant"])
I get the below output.我得到下面的 output。
0 1.000001e+12
1 1.000000e+12
2 1.000001e+12
Could someone please let me know how can I preserve the original number which I believe is treated as float64.有人可以让我知道如何保留我认为被视为 float64 的原始数字。
I tried the below code however that didn't help.我尝试了下面的代码,但是没有帮助。
myarr = df_SalesOrders.variant.astype(str)
Any help is much appreciated.任何帮助深表感谢。 Thanks.
谢谢。
You need to add you change to your dataframe您需要将更改添加到您的 dataframe
df_SalesOrders.variant = df_SalesOrders.variant.astype('int64')
Please call请打电话
pd.options.display.float_format = '{:,.4f}'.format
df
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.