問題タブ [missing-features]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
27 参照

keyerror - KeyError ~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)

\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) try: return self.enter code here_engine.get_loc(casted_key) except KeyError as errenter code here:

~\anaconda3\lib\site-packages\pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

~\anaconda3\lib\site-packages\pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas._libs.hashtable.PyObjectHashTable.get_item() の pandas_libs\hashtable_class_helper.pxi

pandas._libs.hashtable.PyObjectHashTable.get_item() の pandas_libs\hashtable_class_helper.pxi

KeyError: 'YearsInCurrentRole'

上記の例外は、次の例外の直接の原因でした。

KeyError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_25644/809870847.py in 23 # 生成してプロット 24 x = df['Age'].values ---> 25 y = df['YearsInCurrentRole' ].values 26 sns.kdeplot(x, y, cmap=cmap, shade=True, ax=axes[0,2]) 27 axes[0,2].set( title = '年齢に対する役割の年数')

~\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 3456 if self.columns.nlevels > 1: 3457 return self._getitem_multilevel(key) -> 3458 indexer = self.columns .get_loc(key) 3459 if is_integer(indexer): 3460 indexer = [indexer]

~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3361 return self._engine.get_loc(casted_key) 3362 err:enter code here として KeyError を除く - > 3363 is_scalar(key) および isna(key) であり、self.hasnans でない場合、エラー 3364 3365 から KeyError(key) を発生させます。

KeyError: 'YearsInCurrentRole'