python– tag –
-
IndexError: list index out of rangeと出た。【python】
経緯 リストの中を見ようとしたら、 IndexError: list index out of range と出ました。 実際のコマンド a = [2,4,6,7] a[5] 原因 インデックスの範囲外を指定しているのが原因です。 対処 インデックスの指定範囲内を入力しましょう。 a = [2,4,6,7] a[0]... -
IndentationError: unindent does not match any outer indentation levelが出た。【python】
経緯 for i in range():を使って繰り返し処理を行おうしたら、 IndentationError: unindent does not match any outer indentation level と出ました。 実際のコマンド for i in range(4): ans = i + 10 print(ans) 原因 print(ans)のインデントがずれてい... -
TypeError:can only concatenate str (not “int”) to strと出た。【python】
経緯 文字列を結合しようとしたら、 TypeError:can only concatenate str (not "int") to str と出ました。 実際のコマンド number_int = 3 print('python' + number_int) やったこと number_intを文字列にする Pythonでは文字列と数値を+演算子で結合で... -
「コマンドプロンプト」で’Jupyter lab’を起動したら、「File browser」がいつもと違うところに飛んでしまう。【python】
経緯 いつも通り、コマンドプロンプトで'Jupyter lab'を起動したところ、 いつもは”C:/Users/mori/・・・・・”、なのに。 なぜか”C:WINDOWS/system32”に飛んでしまう。 やったこと PATHが通っているか確認 コマンドプロンプトに where jupyter と入力。 C:... -
‘cat’は内部コマンドまたは外部コマンド、操作可能なプログラムまたはバッチファイルとして認識されていません。【python】
経緯 catコマンドでjsonファイルを指定して、ファイルの中身を画面に出力しようとしました。 実際のコマンド !cat data/column_oriented.json やったこと catインストール ! pip install cat → ERROR: Could not find a version that satisfies the requir... -
ConnectionError:が出た。【python】
経緯 requests()を使って、Webサイトからデータを取得しようとしたら、 ConnectionError: HTTPSConnectionPool(host='wworldtimeapi.org', port=443): Max retries exceeded with url: /api/timezone/Asia/Tokyo (Caused by NewConnectionError('<urlli... -
ValueError:No axis named 0.75 for object type DataFrameが出る【python】
経緯 外れ値(異常値)を探そうとquantile()を使ったら、エラーが出ました。 実際のコマンド q = train_ds.quantile([1/4], 3/4) やったこと スペルチェック まずはスペルチェック。 問題ない。 カッコチェック ([1/4],3/4) ここですね。 正しくは、 ([1/4,3... -
Module Not Found Error:No module named ‘sklearn preprocedding’が出る【python】
経緯 sklearnを使って、スケーリングをしようとした。 実際のコマンド from sklearn preprocedding import LabelEncoder やったこと スペルチェック まずはスペルチェック。 「preprocedding」??? これです。 正しくは 「preprocessing」 でした。 原因 pr... -
TypeError: __init__ () got an unexpected keyword argument ‘strateg’が出る【python】
経緯 SimpleImputerにmedian(中央値)を指定しようとしたら、エラー「TypeError:__init__() got an unexpected keyword argument'strateg'」 が出ました。 実際のコマンド age_imputer = SimpleImputer(strateg = 'median') やったこと スペルチェック まず... -
SyntaxError: invalid syntaxが出る【python】
経緯 pivot_table()を使用してインデックスとカラムを指定しようとしたら、エラー「SyntaxError: invalid syntax」 が出ました。。 実際のコマンド graph_data = pd.pivot_table(join_data, index='payment_month', columns~'item_name', values='price', ... -
KeyError:”[‘quantitiy’]” not in indexが出る【python】
経緯 groupby()を使用して集計しようとしたら、エラー(KeyError: "['quantitiy'] not in index")がでた。 実際のコマンド join_data.groupby(["payment_month", "item_name"]).sum()[["price", "quantity"]] やったこと スペルを訂正した。 「quantitiy」... -
AttributeError: ‘DataFrame’object has no attribute ‘sinull’が出る【python】
経緯 isnull()で欠損値を調べていたら、エラーがでた。 実際のコマンド join_data.sinull().sum() やったこと スペルを訂正した。 「sinull」のスペルが間違いで 正しくは、 「isnull」 です。 原因 スペルミスでした。 -
name Error = name ‘pickel’ is not definedが出る【python】
経緯 pickle形式でファイルを保存しようとしたら、エラーがでた。 実際のコマンド with open('保存先のpath', mode='wb') as f : pickel.dump(保存するファイル名, f) やったこと Name errorなので、スペルを訂正した。 「pickel」のスペルが間違いで 正し... -
ModuleNotFoundError:No module named ‘ ’が出た。【python】
症状 import matlotlib.pyplot as plyt と書いたから、エラーが出ました。 対処 単純なスペルミスです。 "matlotlib"を"matplotlib"に書き換えるとエラーは無くなります。 -
“The kernel appears to have died.It will restart automatically”が出た【python】
症状 Jupyter nootbookで import pandas as pd と入力したら、 "The kernel appears to have died.It will restart automatically" というエラーが出た。(PCはMacBook Airです。) やったこと ターミナルで pip install --upgrade pandas と打った。 が、エ...