swdq commited on
Commit
0996062
1 Parent(s): e20c6d5

Upload 3 files

Browse files
Files changed (3) hide show
  1. asmr_data.csv +0 -0
  2. filter.py +49 -0
  3. sorted_asmr_data.csv +0 -0
asmr_data.csv ADDED
The diff for this file is too large to render. See raw diff
 
filter.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from datetime import datetime
3
+
4
+ # ファイルパス
5
+ file_path = r"C:\Users\user\Desktop\git\asmr_title\asmr_data.csv"
6
+
7
+ # 除外したい単語リスト(タイトル用)
8
+ exclude_words = ["実演", "まとめ", "日文版", "中英日", "パック", "セット", "实演", "中日英", "実録", "ブルーアーカイブ", "アズールレーン", "日语"]
9
+
10
+ # 除外したいタグリスト
11
+ exclude_tags = ["ノンフィクション", "体験談", "東方Project", "特定タグ2"]
12
+
13
+ # CSVデータの読み込み
14
+ df = pd.read_csv(file_path)
15
+
16
+ # タイトルに除外したい単語が含まれている行を除外
17
+ title_pattern = '|'.join(exclude_words)
18
+ df = df[~df['Title'].str.contains(title_pattern, case=False, na=False)]
19
+
20
+ # タグに除外したい単語が含まれている行を除外
21
+ tag_pattern = '|'.join(exclude_tags)
22
+ df = df[~df['Tags'].str.contains(tag_pattern, case=False, na=False)]
23
+
24
+ # 現在の日付(今日)
25
+ today = datetime.now()
26
+
27
+ # Date列をdatetime型に変換
28
+ df['Date'] = pd.to_datetime(df['Date'], errors='coerce')
29
+
30
+ # 今日までの経過日数を計算
31
+ df['Days_Since_Sale'] = (today - df['Date']).dt.days
32
+
33
+ # 1日あたりの売上を計算
34
+ df['Sales_Per_Day'] = df['Sales'] / df['Days_Since_Sale']
35
+
36
+ # 1日あたりの売上金額(Sales × Price)を計算
37
+ df['Revenue_Per_Day'] = (df['Sales'] * df['Price']) / df['Days_Since_Sale']
38
+
39
+ # Revenue_Per_Dayが1000以下のデータを除外
40
+ df = df[df['Revenue_Per_Day'] > 500]
41
+
42
+ # 1日あたりの売上金額でソート(降順)
43
+ sorted_df = df.sort_values(by='Revenue_Per_Day', ascending=False)
44
+
45
+ # ソートされたデータを保存
46
+ sorted_df.to_csv(r"C:\Users\user\Desktop\git\asmr_title\sorted_asmr_data.csv", index=False)
47
+
48
+ # 必要な列の表示
49
+ print(sorted_df[['Title', 'Sales', 'Price', 'Date', 'Days_Since_Sale', 'Revenue_Per_Day']].head())
sorted_asmr_data.csv ADDED
The diff for this file is too large to render. See raw diff