首页 > 解决方案 > 我尝试在 jupyter 上运行代码返回错误

问题描述

--------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-18-e20bfc399896> in <module>()
----> 1 collection = pd.read_csv("https://raw.githubusercontent.com/BBKdatasciencetaster/DS/main/data/paintings.csv", index_col=0)
      2 collection.head() # Returns the first five rows

NameError: name 'pd' is not defined

标签: python-3.xjupyter-notebook

解决方案


在单元格的开头添加以下代码:

import pandas as pd

然后重新执行单元格。必须解决这个问题。


推荐阅读