
ChatGPTがCSVやExcelファイルを操作!noteableプラグインで新たな可能性を開拓
こちらの記事を参考にして私もChatGPT4とnoteableプラグインでCSVファイルやExcelを扱ってみました。
最初にnoteableでプロジェクトを作ります。
Q.noteableで「FileAccessTest」というプロジェクトを作ってください
A.「FileAccessTest」というプロジェクトを作成しました。以下のリンクからアクセスできます。
FileAccessTest

プロジェクトのリンクを開きます。
予め「test.csv」というファイルを「UTF-8」で作っておきます。
試験名,担任,学年,組,№,氏名,国語,数学,理科,社会,英語,合計
1学期中間試験,山田 諭,3,1,1,浅野 麻耶,84,74,65,77,78,378
1学期中間試験,山田 諭,3,1,2,井戸 弘樹,55,75,45,58,98,331
1学期中間試験,山田 諭,3,1,3,岡 和重,84,55,75,48,44,306
1学期中間試験,山田 諭,3,1,4,岡本 昭,75,68,75,54,65,337

「Upload」をクリックします。

灰色の四角に「test.csv」をドラッグします。
Q.「FileAccessTest」にある「test.csv」を読み込み最初の10行を表示してください。最初の行はフィールド名です
A.「test.csv」ファイルを読み込み、最初の10行を表示しました。以下にその内容を示します。

Q.国語、算数、理科のそれぞれの平均点を計算してください
A.国語、数学、理科のそれぞれの平均点を計算しました。以下にその結果を示します。
国語の平均点: 74.16
数学の平均点: 69.62
理科の平均点: 70.31

notebookのPythonコードもあっています。
data = pd.read_csv('test.csv')
data.head(10)

average_scores = data[['国語', '数学', '理科']].mean()
average_scores

もしかしたらと思って「CSVファイル」を「Excelファイル」に変えてアップロードして読めるか試してみたら普通に読めました。
Q.test1.xlsxを読んで最初の3行を表示してください
A.「test1.xlsx」ファイルを読み込み、最初の3行を表示しました。以下にその内容を示します。

notebookのPythonコードも問題なさそうです。
data = pd.read_excel('test1.xlsx')
data.head(3)

ExcelファイルをChatGPTで扱えると喜ぶ方が多そうです。