当前位置: 首页 > news >正文

python---‘DataFrame‘ object has no attribute ‘read‘ 报错的解决

代码和报错信息

在读取excel表格信息的时候发生报错:
代码:

detail=pd.read_csv('../data/meal_order_detail.csv',encoding='utf-8')
print(detail.read())

报错信息:

在这里插入图片描述

解决办法

后面加一个:
iterator=True

iterator=True 是 pandas 读取 CSV 文件的一个参数选项。当设置为 True 时,读取器会返回一个 DataFrame 的迭代器,而不是一次性加载整个数据到内存中。这意味着数据会被按块读取,适合处理非常大的数据集,避免内存不足的问题

detail=pd.read_csv('../data/meal_order_detail.csv',encoding='utf-8',iterator=True)
print(detail.read())

再次读取excel的信息:
在这里插入图片描述

可以看到读取成功了!!!


文章转载自:
http://blouse.sxnf.com.cn
http://antagonistical.sxnf.com.cn
http://bywork.sxnf.com.cn
http://cantoris.sxnf.com.cn
http://anthropophobia.sxnf.com.cn
http://catlike.sxnf.com.cn
http://catacomb.sxnf.com.cn
http://bacillicide.sxnf.com.cn
http://autoerotism.sxnf.com.cn
http://borough.sxnf.com.cn
http://amoebiasis.sxnf.com.cn
http://burn.sxnf.com.cn
http://chromo.sxnf.com.cn
http://aghan.sxnf.com.cn
http://avenge.sxnf.com.cn
http://arrondissement.sxnf.com.cn
http://accommodative.sxnf.com.cn
http://angolan.sxnf.com.cn
http://bacchius.sxnf.com.cn
http://chromatophore.sxnf.com.cn
http://cebu.sxnf.com.cn
http://airmail.sxnf.com.cn
http://chauvinism.sxnf.com.cn
http://affrontedness.sxnf.com.cn
http://architectonic.sxnf.com.cn
http://ammonification.sxnf.com.cn
http://abaya.sxnf.com.cn
http://christingle.sxnf.com.cn
http://bowlder.sxnf.com.cn
http://caboodle.sxnf.com.cn
http://www.dtcms.com/a/46202.html

相关文章:

  • 牛客周赛83:A:JAVA
  • 面试题:说一下你对DDD的了解?
  • 常用的api测试软件
  • zookeeper-docker版
  • DeepSeek本地部署教程
  • gmock和cppfreemock原理学习
  • Python使用pyobdc库和tkinter框架连接数据库
  • oracle游标为什么没有共享,统计一下原因
  • 水果识别系统 | BP神经网络水果识别系统,含GUI界面(Matlab)
  • 《白帽子讲 Web 安全:点击劫持》
  • Makefile、Make和CMake:构建工具的三剑客
  • 授权与认证之jwt(一)创建Jwt工具类
  • macOS Sequoia 15.3 M3 Pro芯片 iOS 开发环境配置记录(最新)
  • ZYNQ-PL实践课堂(四)IP核之RAM
  • 经验分享:用一张表解决并发冲突!数据库事务锁的核心实现逻辑
  • python 爬虫用bs4 或者叫Beautiful Soup
  • CSS—text文本、font字体、列表list、表格table、表单input、下拉菜单select
  • 关于后端使用Boolean或boolean时前端收到的参数的区别
  • 基于51单片机的智能温控器设计与实现
  • 哈希算法--猜数字游戏
  • 基于AX58100 EtherCAT从站开发
  • 考研408数据结构线性表核心知识点与易错点详解(附真题示例与避坑指南)
  • llama-factory
  • 132. 分割回文串 II | 最少分割次数
  • Linux网络相关概念和重要知识(1)(网络协议、网络通信)
  • Hashmap
  • FPGA开发,使用Deepseek V3还是R1(8):FPGA的全流程(简略版)
  • Pytorch使用手册—Raspberry Pi 4 上的实时推理(30 FPS!)(专题三十六)
  • C++对象特性
  • Spring Boot分层架构的优势