Skip to content

Commit 7f17835

Browse files
committed
Load the negative dataset to jupyter and rename the positive dataset
1 parent 5995c1a commit 7f17835

3 files changed

Lines changed: 38 additions & 11 deletions

File tree

CLEANED_Spotify_artist_info_random_sample.csv renamed to artists_negative.csv

File renamed without changes.
File renamed without changes.

streamageddon.ipynb

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,52 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": null,
15+
"execution_count": 2,
1616
"id": "31cf5f11-c2d1-4fb5-bfa2-d16d25e6b130",
1717
"metadata": {},
18-
"outputs": [],
18+
"outputs": [
19+
{
20+
"name": "stdout",
21+
"output_type": "stream",
22+
"text": [
23+
"Note: you may need to restart the kernel to use updated packages.\n"
24+
]
25+
}
26+
],
1927
"source": [
2028
"%pip install --quiet pandas==2.3.2 wordcloud==1.9.4"
2129
]
2230
},
2331
{
2432
"cell_type": "code",
25-
"execution_count": 12,
33+
"execution_count": 3,
2634
"id": "564a2258",
2735
"metadata": {},
2836
"outputs": [
2937
{
3038
"name": "stdout",
3139
"output_type": "stream",
3240
"text": [
41+
" ids names popularity followers \\\n",
42+
"0 2P3aLwJ41aRYkyFFw2FRM7 sam concepcion 45 168497 \n",
43+
"1 2FCVB3cfCC0e3O8G7Gs8t6 bleib modern 28 23349 \n",
44+
"2 3ZaPFQ05J5qSM5I3Smbp44 tevvez 58 259154 \n",
45+
"3 71WUmUmWWaqqGtVP8MlPJb semi.official 4 1050 \n",
46+
"4 0MVM5Khj39EkpVtLvU9Ujp ovsicori 4 316 \n",
47+
"\n",
48+
" genres first_release last_release \\\n",
49+
"0 opm 2007 2023 \n",
50+
"1 dark post-punk, modern goth 2014 2024 \n",
51+
"2 gym hardstyle 2018 2024 \n",
52+
"3 abstract hip hop, minnesota hip hop 2003 2003 \n",
53+
"4 ambient 2017 2023 \n",
54+
"\n",
55+
" num_releases num_tracks monthly_listeners \n",
56+
"0 20 1 583900.0 \n",
57+
"1 14 3 40842.0 \n",
58+
"2 20 1 1521671.0 \n",
59+
"3 1 17 820.0 \n",
60+
"4 8 5 1025.0 \n",
3361
"92\n",
3462
"[ 3 5 1 1 20 1 2 6 3 1 1 2 2 1 1 2 1 1 2 1 3 2 2 1\n",
3563
" 1 13 1 8 23 1 1 4 2 3 1 1 1 1 1 1 1 1 9 2 4 9 1 3\n",
@@ -44,7 +72,8 @@
4472
"import matplotlib.pyplot as plt\n",
4573
"from wordcloud import WordCloud\n",
4674
"\n",
47-
"df_csv = pd.read_csv(\"artists.csv\")\n",
75+
"df_positive = pd.read_csv(\"artists_positive.csv\")\n",
76+
"df_negative = pd.read_csv(\"artists_negative.csv\")\n",
4877
"df_json = pd.read_json(\"spotify-artists.json\")\n",
4978
"df_json_normalized = pd.json_normalize(df_json[\"artists\"])\n",
5079
"\n",
@@ -62,12 +91,10 @@
6291
" \"Image\": image}\n",
6392
"\n",
6493
"df_json_final = pd.DataFrame(data)\n",
65-
"df = df_json_final.merge(df_csv, on='SpotifyId', how='inner')\n",
66-
"df[\"Date\"] = pd.to_datetime(df[\"Date\"], format='%Y%m%d')\n",
67-
"#print(df.head())\n",
94+
"df = df_json_final.merge(df_positive, on=\"SpotifyId\", how=\"inner\")\n",
95+
"df[\"Date\"] = pd.to_datetime(df[\"Date\"], format=\"%Y%m%d\")\n",
6896
"\n",
6997
"flat_genres = df.explode(\"Genres\")\n",
70-
"#print(flat_genres)\n",
7198
"\n",
7299
"unique, counts = np.unique(flat_genres[\"Genres\"], return_counts=True)\n",
73100
"print(len(unique))\n",
@@ -202,9 +229,9 @@
202229
],
203230
"metadata": {
204231
"kernelspec": {
205-
"display_name": "Week1",
232+
"display_name": "Python 3 (ipykernel)",
206233
"language": "python",
207-
"name": "week1"
234+
"name": "python3"
208235
},
209236
"language_info": {
210237
"codemirror_mode": {
@@ -216,7 +243,7 @@
216243
"name": "python",
217244
"nbconvert_exporter": "python",
218245
"pygments_lexer": "ipython3",
219-
"version": "3.12.3"
246+
"version": "3.10.12"
220247
}
221248
},
222249
"nbformat": 4,

0 commit comments

Comments
 (0)