我制作了jupyter笔记本文件,并在Windows / Mac PC上对其进行了编辑。
首先导入所需的库,
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
打给他们
dataframe.plot.hist( y=... )
dataframe.plot.scatter( y=... )
在Windows PC中,我可以看到这些绘图图。
但是在Mac PC中,在任何dataframe.plot代码中,我都会在下面看到错误代码。
>ImportError Traceback (most recent call last)
> <ipython-input-18-8044f54f9ad1> in <module>
> ...
>/usr/local/lib/python3.7/site-packages/pandas/plotting/_core.py in \__call\__(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
> 2939 fontsize=fontsize, colormap=colormap, table=table,
> 2940 yerr=yerr, xerr=xerr, secondary_y=secondary_y,
> -> 2941 sort_columns=sort_columns, **kwds)
> 2942 __call__.__doc__ = plot_frame.__doc__
> 2943
> ...
> ...
> ImportError: matplotlib is required for plotting.
我已经通过pip3 install
安装了pandas / matplotlib,不知道问题出在哪里...