在pandas python中没有名为read_csv的属性 [英] no attribute named read_csv in pandas python

查看:9842
本文介绍了在pandas python中没有名为read_csv的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是机器学习的新手,在Python中使用pandas创建一个数据集。我查了一个教程,只是尝试一个基本的代码创建一个数据框架,但我不断得到以下回溯:

I am new to machine learning and am creating a dataset using pandas in Python. I looked up a tutorial and was just trying out a basic code for creating a dataframe, but I keep getting the following trace-back:

AttributeError:'module'没有属性'read_csv'

AttributeError: 'module' object has no attribute 'read_csv'

我已经以csv(逗号分隔)格式从Excel 13保存了csv文件。
这是我的代码:

I have saved the csv file in the csv(comma delimited) formatfrom Excel 13. Here's my code:

    import pandas
    import csv

    mydata = pandas.read_csv('foo.csv')
    target = mydata["Label"]

    data = mydata.ix[:,:-1]


推荐答案

有一个名为 pandas.py (和/或 .pyc ),它是导入的,而不是pandas库。删除或重命名文件解决了问题。

There was a file named pandas.py (and/or pandas.pyc) in the working directory, which was imported instead of the pandas library. Removing or renaming the file/s solved the problem.

这篇关于在pandas python中没有名为read_csv的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆