morishuhei– Author –
-
TypeError: Index(…) must be called with a collection of some kind, ‘******’ was passedのエラー。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit 経緯 ファイル名と日付を無事取得できたので、それをカラムにしようとしたら、TypeError: Index(...) must be called with a collection of some kind, 'ファイル... -
読み込んだcsvファイル名を取得したい。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit 経緯 データを大量に羅列する時に、どの行がどのファイルかを明白にしたいと思い、”ファイル名をcolumnにつけたらいい"と考えた。でも、ファイル名ってどうやって... -
読み込んだcsvファイルのindex:0, column:0のところの文字を取得したい。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit 経緯 csvファイルは読めたので、行とか列とかではなく、ピンポイントで値を取得したいと思いたった。 実際のコマンド df.iat[0,0] 考えたこと 結論から言うと、上... -
1つ以上のライブラリのストレージの場所が使用できなくなりました。作業内容が失われないようにするため、これらのライブラリは閉じられます。
環境 Final cut pro 10.6 mac OS Monterey iMac (Retina 5K, 27-inch,2019) 経緯 Final Cut pro で動画編集していたら、”1つ以上のライブラリのストレージの場所が使用できなくなりました。作業内容が失われないようにするため、これらのライブラリは閉じ... -
【自動運転#2】コンデンサーってどれでいいの?【電子回路Part1】
経緯 自動運転のミニカーを作ろうと色々やってくうちに、モーターを安定して回すために、コンデンサーとやらが必要らしいが、種類がありすぎて、よくわかないのでどれが使えるのか勉強してみました。 環境 ・モーター 買ったミニカーについていたモノ ・... -
Parsererror: Error tokenizing data. C error: Expected 1 fields in line 8, saw 2と出た。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit 経緯 条件抽出をしようとして,>=を使ったら、Parsererror: Error tokenizing data. C error: Expected 1 fields in line 8, saw 2というエラーがでた 実際のコ... -
TypeError:’>=’ not supported between instances of ‘str’ and ‘int’と出た。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit 経緯 条件抽出をしようとして,>=を使ったら、TypeError:'>=' not supported between instances of 'str' and 'int'というエラーがでた 実際のコマンド diff[... -
【自動運転#1】Raspberry Pi 買ったけど。。。【ソフトウェアPart1】
環境 Raspberry Pi MacBook Air バージョン 11.6 経緯 自動運転を勉強したくて、色々調べていたら、ラズパイというモノがあって試しに買ってみた。 やったこと Imagerのインストール ラズパイの公式サイト(こちら)で"Download for macOS"を選択 無事イ... -
iPhone11 Proをメルカリに出品してみた。
環境 iPhone11 Pro 256GB docomo 経緯 リセールバリューってのを体感したくて、iPhone13 Proを買ったので、以前買ったiPhone11 Proをメルカリで売りたいと思いたった。 やったこと 新しいiPhone13 ProにiPhone11 Proのデータを移す。 まず、データの移行を... -
LINEのチャットボットで定期実行をする(Heroku Scheduler)【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) Python 3.8.8 64-bit Heroku LINE API 経緯 LINEのチャットボットを使っているのだが、「定期実行」ができれば、「幹事などやる時便利かも」と思い調べてみら、「Heroku scheduler」と... -
Visual Studio CodeでHTMLの補完機能が効かない。【python】
環境 Windowsの仕様 エディション:Windows 10 Pro バージョン:20H2 経緯 Pythonのことではありませんが、 Flaskを勉強中にいつも使っているiOSではなく、windowns環境でVisual Studio Codeを使い、HTMLを使っていたら、tabキーで補完機能を使おうとしたら... -
ModuleNotFoundError:No module named ‘flask’と出た。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) VisualStudioCode Python 3.8.8 64-bit 経緯 Flaskでデータベースを作成しようとして、「app」から「db」をインポートしようとしたら、 ModuleNotFoundError: No module named 'flask' ... -
Error: Failed to find Flask application or factory in module “hello”. Use “FLASK_APP=hello:name to specify one.と出た。【python】
環境 MacBook Air (11-inch, Early 2015) バージョン11.6(20G165) VisualStudioCode Python 3.8.8 64-bit 経緯 Flaskを勉強しようとして、環境変数を設定して、Flaskを走らせようと、 Error: Failed to find Flask application or factory in module "h... -
NameError: name ‘any_var’ is not definedと出た。【python】
経緯 変数を使って計算しようとしたら、 NameError: name 'any_var' is not difined と出ました。 実際のコマンド any_var += 1 原因 any_varという名前の変数が定義される前に使ったことが原因です。 対処 変数を定義してから、使いましょう。 any_var = ... -
KeyError:’c’と出た。【python】
経緯 辞書型でキーにアクセスにしようとしたら、 KeyError: 'c' と出ました。 実際のコマンド a = {'a': 10, 'b':20} a['c'] 原因 辞書型で存在していないキー(ここでいうと'c'ですね)でアクセスしたのが原因です。 対処 存在しているキーをよく確認しま... -
TypeError: can only conatenate list (not “int”) to listが出た。【python】
経緯 足し算をしようとしたら、 TypeError: can only conatenate list (not "int") to list と出ました。 実際のコマンド [2] + 2 原因 リスト型とリスト型以外のものを足しているのでエラーが出てしまいました。 対処 型を合わせると解決します。 [2] + [2] -
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でPlotly使いグラフを表示させようとしたが、グラフが表示されない。【python】
経緯 plotly()を使って、グラフを可視化しようと試みた。 がデータは読めて、エラーも出なかったが、画面が真っ白でなにも表示されなかった。 実際のコード import plotly.express as px fig = px.line(x=df['receive_time'], y=df['in1']) fig.show() 画... -
「コマンドプロンプト」で’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」のスペルが間違いで 正し...