“模块"对象没有属性"DataFrame" [英] 'module' object has no attribute 'DataFrame'

查看:227
本文介绍了“模块"对象没有属性"DataFrame"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于以下代码:

df = pd.DataFrame(np.random.rand(12,2), columns=['Apples', 'Oranges'] )
df['Categories'] = pd.Series(list('AAAABBBBCCCC'))
pd.options.display.mpl_style = 'default'
df.boxplot(by='Categories')

我得到了错误:

'module' object has no attribute 'DataFrame'.

关于正在发生的事情以及如何解决此问题的任何想法?

Any ideas on what is happening and how to fix this problem?

推荐答案

此处显示的代码没有显示出这种差异,但是有时在全部使用小写字母时调用dataframe时我会卡住.

The code presented here doesn't show this discrepancy, but sometimes I get stuck when invoking dataframe in all lower case.

切换为驼峰式(pd.DataFrame())可以解决问题.

Switching to camel-case (pd.DataFrame()) cleans up the problem.

这篇关于“模块"对象没有属性"DataFrame"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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