0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

2023のAmazon購入履歴をEDAする

Last updated at Posted at 2024-01-04

はじめに

Amazonでの書籍の購買履歴をインプットに、ChatGPTでデータハンドリングを試してみます。

データインプット

image.png

さらに、分析の方向性も提案してくれます。

image.png

前処理

はじめにデータの前処理を行ってもらいます。

image.png

エラーを起こしながらも、それを含めて対処してくれました。

image.png


# Remove any potential quotes from the date column
data['注文日'] = data['注文日'].str.replace('"', '')

# Retry converting 注文日 to datetime
data['注文日'] = pd.to_datetime(data['注文日'], format='%Y/%m/%d', errors='coerce')

# Re-extract month, week, and day of week
data[''] = data['注文日'].dt.month
data[''] = data['注文日'].dt.isocalendar().week
data['曜日'] = data['注文日'].dt.day_name()

# Re-display the modified dataframe
data.head()

サンプルで内容を見てみましょう。


# Display the first 5 rows of the updated dataframe
data.head(5)

基礎統計の確認

  • 年間の合計: 390,167円 / 185冊
  • 月の平均:32,514円 / 約15.42冊
  • 1週間平均:7,503円 / 約3.56冊

image.png

image.png

image.png

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?