尝试读取 shapefile (.shp) 并在执行以下代码行后收到ImportError 。在执行下面的代码之前,我什至 pip 安装了 GDAL、geopandas、fiona 和 shapely。
shapefile = gpd.read_file(r'C:\Users\....\Data Analysis\shapefiles\louisville.shp')
Run Code Online (Sandbox Code Playgroud)
收到的错误如下,
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-164-16243badadbe> in <module>
----> 1 shapefile = gpd.read_file(r'C:\Users\....\Data Analysis\shapefiles\louisville.shp')
~\Anaconda3\lib\site-packages\geopandas\io\file.py in _read_file(filename, bbox, mask, rows, **kwargs)
164 by using the encoding keyword parameter, e.g. ``encoding='utf-8'``.
165 """
--> 166 _check_fiona("'read_file' function")
167 filename = _expand_user(filename)
168
~\Anaconda3\lib\site-packages\geopandas\io\file.py in _check_fiona(func)
78 def _check_fiona(func):
79 if fiona is None:
---> 80 raise ImportError(
81 f"the {func} requires the …Run Code Online (Sandbox Code Playgroud) 我正在尝试与 Featuretools 合作,为客户流失数据集开发自动化特征工程工作流程。最终结果是一个函数,它接收数据集和客户的标签时间,并构建可用于训练机器学习模型的特征矩阵。
作为本练习的一部分,我尝试执行下面的代码来绘制直方图,并得到“ TypeError: import_Optional_dependency() got an Unexpected keywords argument 'errors' ”。请帮助解决此类型错误。
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (10, 6)
trans.loc[trans['actual_amount_paid'] < 250, 'actual_amount_paid'].dropna().plot.hist(bins = 30)
plt.title('Distribution of Actual Amount Paid')
Run Code Online (Sandbox Code Playgroud)
以下是我收到的完整错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-7e19affd5fc1> in <module>
4 plt.rcParams['figure.figsize'] = (10, 6)
5
----> 6 trans.loc[trans['actual_amount_paid'] < 250, 'actual_amount_paid'].dropna().plot.hist(bins = 30)
7 plt.title('Distribution of Actual Amount Paid')
~\anaconda3\lib\site-packages\pandas\core\ops\common.py in new_method(self, other)
63 break
64 if isinstance(other, cls):
---> 65 return NotImplemented …Run Code Online (Sandbox Code Playgroud)