Problems importing pandas.plotting

后端 未结 4 456
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 20:48

When I import pandas, everything is fine and working. Yet, when I try to import something from pandas.plotting im getting an error. What could be the source of

4条回答
  •  隐瞒了意图╮
    2021-01-03 21:07

    Unfortunately, it looks as though there has been some confusion around the movement of that module. The plotting module has been moved from pandas.tools.plotting to pandas.plotting. The difficulty is most likely stemming from the fact that as of version 0.19, the pandas.plotting library did not exist.

    The current version is version 0.22. If you receive this error, the best practice is to update your version of pandas to the most recent version.

    If, for some reason, you are unable to do this, the correct code for earlier versions of pandas would be

    from pandas.tools.plotting import scatter_matrix
    

    The correct code for current versions of pandas would be

    from pandas.plotting import scatter_matrix
    

提交回复
热议问题