【问题标题】:Having a problem with seaborn python moduleseaborn python模块有问题
【发布时间】:2020-10-19 14:15:58
【问题描述】:

今天我按照https://nbviewer.jupyter.org/github/savvastj/nbashots/blob/master/tutorial/Tutorial.ipynbhttps://nbviewer.jupyter.org/github/savvastj/nbashots/blob/master/tutorial/Tutorial.ipynb的教程开始了一个个人项目
但是我一开始就遇到了问题,我不知道为什么,这与我猜的模块有关但我都安装了

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import nbashots as nba # this will throw a warning if using matplotlib 1.5



curry_id = nba.get_player_id("Curry, Stephen")[0]
curry_id

我运行它并得到了这个错误

Traceback (most recent call last):
  File "C:\Users\carlo\Downloads\ye.py", line 2, in <module>
    import seaborn as sns
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python38\lib\site-packages\seaborn\__init__.py", line 5, in <module>
    from .categorical import *
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python38\lib\site-packages\seaborn\categorical.py", line 7, in <module>
    from pandas.core.series import remove_na
ImportError: cannot import name 'remove_na' from 'pandas.core.series' (C:\Users\carlo\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\series.py)

【问题讨论】:

标签: python data-visualization seaborn


【解决方案1】:

查看教程中使用的 Pandas、matplotlib、seaborn 的版本以及您正在使用的版本。如果有冲突,先用pandasseaborn的具体版本创建一个conda环境。

例如,你可以这样做:

conda create -n myenv python=3.7 scipy=0.15.0 将环境激活为conda activate myenv 后,您可以搜索conda 安装包。它将检查依赖性问题并根据python 的版本和已安装的所有其他软件包安装新软件包。因此,当您安装新软件包时,它们已经与您的需求兼容,但您需要找到其中任何一个软件包的版本。

【讨论】:

    猜你喜欢
    • 2016-05-12
    • 2012-11-14
    • 2015-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多