• 欢迎访问显哥博客,本网站纯属学习技术,绝无商业用途,欢迎小伙伴们共同学习!研究技术!QQ:52249909 加我QQ
  • 世界75亿人,这么小的概率,能认识你,是我一生的幸运,不妨加个QQ接触一下:52249909 加我QQ

Python之pandas读取Excel表格空值为NAN的处理【显哥出品,必为精品】

Python开发 lixian 2年前 (2023-02-16) 6486次浏览 4个评论 扫描二维码
后来几经查询才发现pandas默认读取空字符串时读出的是nan,在使用 pandas.read_excel(file)这个方法时可以在后面加上keep_default_na=False,这样读取到空字符串时读出的就是''而不是nan了:
df = pd.read_excel('file.xlsx',keep_default_na=False)

本站博主 , 版权所有丨如未注明 , 均为原创
转载请注明原文链接:Python之pandas读取Excel表格空值为NAN的处理【显哥出品,必为精品】
喜欢 (0)

您必须 登录 才能发表评论!

(4)个小伙伴在吐槽
  1. E-Devlet uzerinden onaylanmis diploma hizmeti ile mezuniyet belgenizi guvenli ve hizli bir sekilde alabilirsiniz. Artik sira beklemek veya evrak isleriyle ugrasmak zorunda degilsiniz. E-Devlet onayli diploma hizmeti ile islemlerinizi online olarak tamamlayabilirsiniz. Detayli bilgi icin hemen tiklayin!
  2. Your article helped me a lot, is there any more related content? Thanks!
  3. I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will
  4. I really like reading through a post that can make men and women think. Also, thank you for allowing me to comment!