Spaces:
Runtime error
Runtime error
nlovoldegar
commited on
Commit
•
dc354d0
1
Parent(s):
eeee601
Upload 3 files
Browse files- finalapp.ipynb +168 -0
- preprocessed_data.ipynb +2062 -0
- requirements.txt +4 -0
finalapp.ipynb
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "ae69f2ba",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"import streamlit as st\n",
|
11 |
+
"st.set_page_config(page_title=\"Karaoke Playlist Generator\", layout=\"wide\")\n",
|
12 |
+
"st.markdown \"Plan your performance\"\n",
|
13 |
+
"import pandas as pd\n",
|
14 |
+
"from sklearn.neighbors import NearestNeighbors\n",
|
15 |
+
"import plotly.express as px\n",
|
16 |
+
"import streamlit.components.v1 as components\n",
|
17 |
+
"\n",
|
18 |
+
"@st.cache(allow_output_mutation=True)\n",
|
19 |
+
"def load_data():\n",
|
20 |
+
" df = pd.read_csv(\"data/filtered_track_df.csv\")\n",
|
21 |
+
" df['genres'] = df.genres.apply(lambda x: [i[1:-1] for i in str(x)[1:-1].split(\", \")])\n",
|
22 |
+
" exploded_track_df = df.explode(\"genres\")\n",
|
23 |
+
" return exploded_track_df\n",
|
24 |
+
"\n",
|
25 |
+
"genre_names = ['Dance Pop', 'Electronic', 'Electropop', 'Hip Hop', 'Jazz', 'K-pop', 'Latin', 'Pop', 'Pop Rap', 'R&B', 'Rock']\n",
|
26 |
+
"audio_feats = [\"acousticness\", \"danceability\", \"energy\", \"instrumentalness\", \"valence\", \"tempo\"]\n",
|
27 |
+
"\n",
|
28 |
+
"exploded_track_df = load_data()\n",
|
29 |
+
"\n",
|
30 |
+
"def n_neighbors_uri_audio(genre, start_year, end_year, test_feat):\n",
|
31 |
+
" genre = genre.lower()\n",
|
32 |
+
" genre_data = exploded_track_df[(exploded_track_df[\"genres\"]==genre) & (exploded_track_df[\"release_year\"]>=start_year) & (exploded_track_df[\"release_year\"]<=end_year)]\n",
|
33 |
+
" genre_data = genre_data.sort_values(by='popularity', ascending=False)[:500]\n",
|
34 |
+
"\n",
|
35 |
+
" neigh = NearestNeighbors()\n",
|
36 |
+
" neigh.fit(genre_data[audio_feats].to_numpy())\n",
|
37 |
+
"\n",
|
38 |
+
" n_neighbors = neigh.kneighbors([test_feat], n_neighbors=len(genre_data), return_distance=False)[0]\n",
|
39 |
+
"\n",
|
40 |
+
" uris = genre_data.iloc[n_neighbors][\"uri\"].tolist()\n",
|
41 |
+
" audios = genre_data.iloc[n_neighbors][audio_feats].to_numpy()\n",
|
42 |
+
" return uris, audios\n",
|
43 |
+
"\n",
|
44 |
+
"\n",
|
45 |
+
"title = \"Karaoke Performance Geneartp\"\n",
|
46 |
+
"st.title(title)\n",
|
47 |
+
"\n",
|
48 |
+
"st.write(\"Customize your performance based on genre and several key audio features!\")\n",
|
49 |
+
"st.markdown(\"##\")\n",
|
50 |
+
"\n",
|
51 |
+
"with st.container():\n",
|
52 |
+
" col1, col2,col3,col4 = st.columns((2,0.5,0.5,0.5))\n",
|
53 |
+
" with col3:\n",
|
54 |
+
" st.markdown(\"***Choose your genre:***\")\n",
|
55 |
+
" genre = st.radio(\n",
|
56 |
+
" \"\",\n",
|
57 |
+
" genre_names, index=genre_names.index(\"Pop\"))\n",
|
58 |
+
" with col1:\n",
|
59 |
+
" st.markdown(\"***Choose features to customize:***\")\n",
|
60 |
+
" start_year, end_year = st.slider(\n",
|
61 |
+
" 'Select the year range',\n",
|
62 |
+
" 1990, 2019, (2015, 2019)\n",
|
63 |
+
" )\n",
|
64 |
+
" acousticness = st.slider(\n",
|
65 |
+
" 'Acousticness',\n",
|
66 |
+
" 0.0, 1.0, 0.5)\n",
|
67 |
+
" danceability = st.slider(\n",
|
68 |
+
" 'Danceability',\n",
|
69 |
+
" 0.0, 1.0, 0.5)\n",
|
70 |
+
" energy = st.slider(\n",
|
71 |
+
" 'Energy',\n",
|
72 |
+
" 0.0, 1.0, 0.5)\n",
|
73 |
+
" instrumentalness = st.slider(\n",
|
74 |
+
" 'Instrumentalness',\n",
|
75 |
+
" 0.0, 1.0, 0.0)\n",
|
76 |
+
" valence = st.slider(\n",
|
77 |
+
" 'Valence',\n",
|
78 |
+
" 0.0, 1.0, 0.45)\n",
|
79 |
+
" tempo = st.slider(\n",
|
80 |
+
" 'Tempo',\n",
|
81 |
+
" 0.0, 244.0, 118.0)\n",
|
82 |
+
"\n",
|
83 |
+
"tracks_per_page = 6\n",
|
84 |
+
"test_feat = [acousticness, danceability, energy, instrumentalness, valence, tempo]\n",
|
85 |
+
"uris, audios = n_neighbors_uri_audio(genre, start_year, end_year, test_feat)\n",
|
86 |
+
"\n",
|
87 |
+
"tracks = []\n",
|
88 |
+
"for uri in uris:\n",
|
89 |
+
" track = \"\"\"<iframe src=\"https://open.spotify.com/embed/track/{}\" width=\"260\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\" allow=\"encrypted-media\"></iframe>\"\"\".format(uri)\n",
|
90 |
+
" tracks.append(track)\n",
|
91 |
+
"\n",
|
92 |
+
"if 'previous_inputs' not in st.session_state:\n",
|
93 |
+
" st.session_state['previous_inputs'] = [genre, start_year, end_year] + test_feat\n",
|
94 |
+
"\n",
|
95 |
+
"current_inputs = [genre, start_year, end_year] + test_feat\n",
|
96 |
+
"if current_inputs != st.session_state['previous_inputs']:\n",
|
97 |
+
" if 'start_track_i' in st.session_state:\n",
|
98 |
+
" st.session_state['start_track_i'] = 0\n",
|
99 |
+
" st.session_state['previous_inputs'] = current_inputs\n",
|
100 |
+
"\n",
|
101 |
+
"if 'start_track_i' not in st.session_state:\n",
|
102 |
+
" st.session_state['start_track_i'] = 0\n",
|
103 |
+
"\n",
|
104 |
+
"with st.container():\n",
|
105 |
+
" col1, col2, col3 = st.columns([2,1,2])\n",
|
106 |
+
" if st.button(\"Recommend More Songs\"):\n",
|
107 |
+
" if st.session_state['start_track_i'] < len(tracks):\n",
|
108 |
+
" st.session_state['start_track_i'] += tracks_per_page\n",
|
109 |
+
"\n",
|
110 |
+
" current_tracks = tracks[st.session_state['start_track_i']: st.session_state['start_track_i'] + tracks_per_page]\n",
|
111 |
+
" current_audios = audios[st.session_state['start_track_i']: st.session_state['start_track_i'] + tracks_per_page]\n",
|
112 |
+
" if st.session_state['start_track_i'] < len(tracks):\n",
|
113 |
+
" for i, (track, audio) in enumerate(zip(current_tracks, current_audios)):\n",
|
114 |
+
" if i%2==0:\n",
|
115 |
+
" with col1:\n",
|
116 |
+
" components.html(\n",
|
117 |
+
" track,\n",
|
118 |
+
" height=400,\n",
|
119 |
+
" )\n",
|
120 |
+
" with st.expander(\"See more details\"):\n",
|
121 |
+
" df = pd.DataFrame(dict(\n",
|
122 |
+
" r=audio[:5],\n",
|
123 |
+
" theta=audio_feats[:5]))\n",
|
124 |
+
" fig = px.line_polar(df, r='r', theta='theta', line_close=True)\n",
|
125 |
+
" fig.update_layout(height=400, width=340)\n",
|
126 |
+
" st.plotly_chart(fig)\n",
|
127 |
+
" \n",
|
128 |
+
" else:\n",
|
129 |
+
" with col3:\n",
|
130 |
+
" components.html(\n",
|
131 |
+
" track,\n",
|
132 |
+
" height=400,\n",
|
133 |
+
" )\n",
|
134 |
+
" with st.expander(\"See more details\"):\n",
|
135 |
+
" df = pd.DataFrame(dict(\n",
|
136 |
+
" r=audio[:5],\n",
|
137 |
+
" theta=audio_feats[:5]))\n",
|
138 |
+
" fig = px.line_polar(df, r='r', theta='theta', line_close=True)\n",
|
139 |
+
" fig.update_layout(height=400, width=340)\n",
|
140 |
+
" st.plotly_chart(fig)\n",
|
141 |
+
"\n",
|
142 |
+
" else:\n",
|
143 |
+
" st.write(\"No songs left to recommend\")"
|
144 |
+
]
|
145 |
+
}
|
146 |
+
],
|
147 |
+
"metadata": {
|
148 |
+
"kernelspec": {
|
149 |
+
"display_name": "Python 3 (ipykernel)",
|
150 |
+
"language": "python",
|
151 |
+
"name": "python3"
|
152 |
+
},
|
153 |
+
"language_info": {
|
154 |
+
"codemirror_mode": {
|
155 |
+
"name": "ipython",
|
156 |
+
"version": 3
|
157 |
+
},
|
158 |
+
"file_extension": ".py",
|
159 |
+
"mimetype": "text/x-python",
|
160 |
+
"name": "python",
|
161 |
+
"nbconvert_exporter": "python",
|
162 |
+
"pygments_lexer": "ipython3",
|
163 |
+
"version": "3.8.13"
|
164 |
+
}
|
165 |
+
},
|
166 |
+
"nbformat": 4,
|
167 |
+
"nbformat_minor": 5
|
168 |
+
}
|
preprocessed_data.ipynb
ADDED
@@ -0,0 +1,2062 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": []
|
7 |
+
},
|
8 |
+
"kernelspec": {
|
9 |
+
"name": "python3",
|
10 |
+
"display_name": "Python 3"
|
11 |
+
},
|
12 |
+
"language_info": {
|
13 |
+
"name": "python"
|
14 |
+
}
|
15 |
+
},
|
16 |
+
"cells": [
|
17 |
+
{
|
18 |
+
"cell_type": "code",
|
19 |
+
"execution_count": 1,
|
20 |
+
"metadata": {
|
21 |
+
"id": "FplIdD623HAp"
|
22 |
+
},
|
23 |
+
"outputs": [],
|
24 |
+
"source": [
|
25 |
+
"import pandas as pd"
|
26 |
+
]
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"cell_type": "code",
|
30 |
+
"source": [
|
31 |
+
"from google.colab import files\n",
|
32 |
+
"files.upload()"
|
33 |
+
],
|
34 |
+
"metadata": {
|
35 |
+
"colab": {
|
36 |
+
"base_uri": "https://localhost:8080/",
|
37 |
+
"height": 91
|
38 |
+
},
|
39 |
+
"id": "1Q3uH4fM5kEC",
|
40 |
+
"outputId": "66ca70c8-4e9f-4da4-ef3e-1e50c96023d6"
|
41 |
+
},
|
42 |
+
"execution_count": 3,
|
43 |
+
"outputs": [
|
44 |
+
{
|
45 |
+
"output_type": "display_data",
|
46 |
+
"data": {
|
47 |
+
"text/plain": [
|
48 |
+
"<IPython.core.display.HTML object>"
|
49 |
+
],
|
50 |
+
"text/html": [
|
51 |
+
"\n",
|
52 |
+
" <input type=\"file\" id=\"files-1551534a-a390-4a9d-84fd-7429e378414c\" name=\"files[]\" multiple disabled\n",
|
53 |
+
" style=\"border:none\" />\n",
|
54 |
+
" <output id=\"result-1551534a-a390-4a9d-84fd-7429e378414c\">\n",
|
55 |
+
" Upload widget is only available when the cell has been executed in the\n",
|
56 |
+
" current browser session. Please rerun this cell to enable.\n",
|
57 |
+
" </output>\n",
|
58 |
+
" <script>// Copyright 2017 Google LLC\n",
|
59 |
+
"//\n",
|
60 |
+
"// Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
61 |
+
"// you may not use this file except in compliance with the License.\n",
|
62 |
+
"// You may obtain a copy of the License at\n",
|
63 |
+
"//\n",
|
64 |
+
"// http://www.apache.org/licenses/LICENSE-2.0\n",
|
65 |
+
"//\n",
|
66 |
+
"// Unless required by applicable law or agreed to in writing, software\n",
|
67 |
+
"// distributed under the License is distributed on an \"AS IS\" BASIS,\n",
|
68 |
+
"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
|
69 |
+
"// See the License for the specific language governing permissions and\n",
|
70 |
+
"// limitations under the License.\n",
|
71 |
+
"\n",
|
72 |
+
"/**\n",
|
73 |
+
" * @fileoverview Helpers for google.colab Python module.\n",
|
74 |
+
" */\n",
|
75 |
+
"(function(scope) {\n",
|
76 |
+
"function span(text, styleAttributes = {}) {\n",
|
77 |
+
" const element = document.createElement('span');\n",
|
78 |
+
" element.textContent = text;\n",
|
79 |
+
" for (const key of Object.keys(styleAttributes)) {\n",
|
80 |
+
" element.style[key] = styleAttributes[key];\n",
|
81 |
+
" }\n",
|
82 |
+
" return element;\n",
|
83 |
+
"}\n",
|
84 |
+
"\n",
|
85 |
+
"// Max number of bytes which will be uploaded at a time.\n",
|
86 |
+
"const MAX_PAYLOAD_SIZE = 100 * 1024;\n",
|
87 |
+
"\n",
|
88 |
+
"function _uploadFiles(inputId, outputId) {\n",
|
89 |
+
" const steps = uploadFilesStep(inputId, outputId);\n",
|
90 |
+
" const outputElement = document.getElementById(outputId);\n",
|
91 |
+
" // Cache steps on the outputElement to make it available for the next call\n",
|
92 |
+
" // to uploadFilesContinue from Python.\n",
|
93 |
+
" outputElement.steps = steps;\n",
|
94 |
+
"\n",
|
95 |
+
" return _uploadFilesContinue(outputId);\n",
|
96 |
+
"}\n",
|
97 |
+
"\n",
|
98 |
+
"// This is roughly an async generator (not supported in the browser yet),\n",
|
99 |
+
"// where there are multiple asynchronous steps and the Python side is going\n",
|
100 |
+
"// to poll for completion of each step.\n",
|
101 |
+
"// This uses a Promise to block the python side on completion of each step,\n",
|
102 |
+
"// then passes the result of the previous step as the input to the next step.\n",
|
103 |
+
"function _uploadFilesContinue(outputId) {\n",
|
104 |
+
" const outputElement = document.getElementById(outputId);\n",
|
105 |
+
" const steps = outputElement.steps;\n",
|
106 |
+
"\n",
|
107 |
+
" const next = steps.next(outputElement.lastPromiseValue);\n",
|
108 |
+
" return Promise.resolve(next.value.promise).then((value) => {\n",
|
109 |
+
" // Cache the last promise value to make it available to the next\n",
|
110 |
+
" // step of the generator.\n",
|
111 |
+
" outputElement.lastPromiseValue = value;\n",
|
112 |
+
" return next.value.response;\n",
|
113 |
+
" });\n",
|
114 |
+
"}\n",
|
115 |
+
"\n",
|
116 |
+
"/**\n",
|
117 |
+
" * Generator function which is called between each async step of the upload\n",
|
118 |
+
" * process.\n",
|
119 |
+
" * @param {string} inputId Element ID of the input file picker element.\n",
|
120 |
+
" * @param {string} outputId Element ID of the output display.\n",
|
121 |
+
" * @return {!Iterable<!Object>} Iterable of next steps.\n",
|
122 |
+
" */\n",
|
123 |
+
"function* uploadFilesStep(inputId, outputId) {\n",
|
124 |
+
" const inputElement = document.getElementById(inputId);\n",
|
125 |
+
" inputElement.disabled = false;\n",
|
126 |
+
"\n",
|
127 |
+
" const outputElement = document.getElementById(outputId);\n",
|
128 |
+
" outputElement.innerHTML = '';\n",
|
129 |
+
"\n",
|
130 |
+
" const pickedPromise = new Promise((resolve) => {\n",
|
131 |
+
" inputElement.addEventListener('change', (e) => {\n",
|
132 |
+
" resolve(e.target.files);\n",
|
133 |
+
" });\n",
|
134 |
+
" });\n",
|
135 |
+
"\n",
|
136 |
+
" const cancel = document.createElement('button');\n",
|
137 |
+
" inputElement.parentElement.appendChild(cancel);\n",
|
138 |
+
" cancel.textContent = 'Cancel upload';\n",
|
139 |
+
" const cancelPromise = new Promise((resolve) => {\n",
|
140 |
+
" cancel.onclick = () => {\n",
|
141 |
+
" resolve(null);\n",
|
142 |
+
" };\n",
|
143 |
+
" });\n",
|
144 |
+
"\n",
|
145 |
+
" // Wait for the user to pick the files.\n",
|
146 |
+
" const files = yield {\n",
|
147 |
+
" promise: Promise.race([pickedPromise, cancelPromise]),\n",
|
148 |
+
" response: {\n",
|
149 |
+
" action: 'starting',\n",
|
150 |
+
" }\n",
|
151 |
+
" };\n",
|
152 |
+
"\n",
|
153 |
+
" cancel.remove();\n",
|
154 |
+
"\n",
|
155 |
+
" // Disable the input element since further picks are not allowed.\n",
|
156 |
+
" inputElement.disabled = true;\n",
|
157 |
+
"\n",
|
158 |
+
" if (!files) {\n",
|
159 |
+
" return {\n",
|
160 |
+
" response: {\n",
|
161 |
+
" action: 'complete',\n",
|
162 |
+
" }\n",
|
163 |
+
" };\n",
|
164 |
+
" }\n",
|
165 |
+
"\n",
|
166 |
+
" for (const file of files) {\n",
|
167 |
+
" const li = document.createElement('li');\n",
|
168 |
+
" li.append(span(file.name, {fontWeight: 'bold'}));\n",
|
169 |
+
" li.append(span(\n",
|
170 |
+
" `(${file.type || 'n/a'}) - ${file.size} bytes, ` +\n",
|
171 |
+
" `last modified: ${\n",
|
172 |
+
" file.lastModifiedDate ? file.lastModifiedDate.toLocaleDateString() :\n",
|
173 |
+
" 'n/a'} - `));\n",
|
174 |
+
" const percent = span('0% done');\n",
|
175 |
+
" li.appendChild(percent);\n",
|
176 |
+
"\n",
|
177 |
+
" outputElement.appendChild(li);\n",
|
178 |
+
"\n",
|
179 |
+
" const fileDataPromise = new Promise((resolve) => {\n",
|
180 |
+
" const reader = new FileReader();\n",
|
181 |
+
" reader.onload = (e) => {\n",
|
182 |
+
" resolve(e.target.result);\n",
|
183 |
+
" };\n",
|
184 |
+
" reader.readAsArrayBuffer(file);\n",
|
185 |
+
" });\n",
|
186 |
+
" // Wait for the data to be ready.\n",
|
187 |
+
" let fileData = yield {\n",
|
188 |
+
" promise: fileDataPromise,\n",
|
189 |
+
" response: {\n",
|
190 |
+
" action: 'continue',\n",
|
191 |
+
" }\n",
|
192 |
+
" };\n",
|
193 |
+
"\n",
|
194 |
+
" // Use a chunked sending to avoid message size limits. See b/62115660.\n",
|
195 |
+
" let position = 0;\n",
|
196 |
+
" do {\n",
|
197 |
+
" const length = Math.min(fileData.byteLength - position, MAX_PAYLOAD_SIZE);\n",
|
198 |
+
" const chunk = new Uint8Array(fileData, position, length);\n",
|
199 |
+
" position += length;\n",
|
200 |
+
"\n",
|
201 |
+
" const base64 = btoa(String.fromCharCode.apply(null, chunk));\n",
|
202 |
+
" yield {\n",
|
203 |
+
" response: {\n",
|
204 |
+
" action: 'append',\n",
|
205 |
+
" file: file.name,\n",
|
206 |
+
" data: base64,\n",
|
207 |
+
" },\n",
|
208 |
+
" };\n",
|
209 |
+
"\n",
|
210 |
+
" let percentDone = fileData.byteLength === 0 ?\n",
|
211 |
+
" 100 :\n",
|
212 |
+
" Math.round((position / fileData.byteLength) * 100);\n",
|
213 |
+
" percent.textContent = `${percentDone}% done`;\n",
|
214 |
+
"\n",
|
215 |
+
" } while (position < fileData.byteLength);\n",
|
216 |
+
" }\n",
|
217 |
+
"\n",
|
218 |
+
" // All done.\n",
|
219 |
+
" yield {\n",
|
220 |
+
" response: {\n",
|
221 |
+
" action: 'complete',\n",
|
222 |
+
" }\n",
|
223 |
+
" };\n",
|
224 |
+
"}\n",
|
225 |
+
"\n",
|
226 |
+
"scope.google = scope.google || {};\n",
|
227 |
+
"scope.google.colab = scope.google.colab || {};\n",
|
228 |
+
"scope.google.colab._files = {\n",
|
229 |
+
" _uploadFiles,\n",
|
230 |
+
" _uploadFilesContinue,\n",
|
231 |
+
"};\n",
|
232 |
+
"})(self);\n",
|
233 |
+
"</script> "
|
234 |
+
]
|
235 |
+
},
|
236 |
+
"metadata": {}
|
237 |
+
},
|
238 |
+
{
|
239 |
+
"output_type": "stream",
|
240 |
+
"name": "stdout",
|
241 |
+
"text": [
|
242 |
+
"Saving kaggle.json to kaggle.json\n"
|
243 |
+
]
|
244 |
+
},
|
245 |
+
{
|
246 |
+
"output_type": "execute_result",
|
247 |
+
"data": {
|
248 |
+
"text/plain": [
|
249 |
+
"{'kaggle.json': b'{\"username\":\"nicolelovoldegar\",\"key\":\"6f3b82ca462a786dec38b73cb86062fc\"}'}"
|
250 |
+
]
|
251 |
+
},
|
252 |
+
"metadata": {},
|
253 |
+
"execution_count": 3
|
254 |
+
}
|
255 |
+
]
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"cell_type": "code",
|
259 |
+
"source": [
|
260 |
+
"!mkdir ~/.kaggle/\n",
|
261 |
+
"!cp kaggle.json ~/.kaggle/"
|
262 |
+
],
|
263 |
+
"metadata": {
|
264 |
+
"id": "XIfkGtcN5veF"
|
265 |
+
},
|
266 |
+
"execution_count": 5,
|
267 |
+
"outputs": []
|
268 |
+
},
|
269 |
+
{
|
270 |
+
"cell_type": "code",
|
271 |
+
"source": [
|
272 |
+
"!chmod 600 ~/.kaggle/kaggle.json"
|
273 |
+
],
|
274 |
+
"metadata": {
|
275 |
+
"id": "Lv7BUFzs5so1"
|
276 |
+
},
|
277 |
+
"execution_count": 6,
|
278 |
+
"outputs": []
|
279 |
+
},
|
280 |
+
{
|
281 |
+
"cell_type": "code",
|
282 |
+
"source": [
|
283 |
+
"!kaggle datasets download -d saurabhshahane/spotgen-music-dataset"
|
284 |
+
],
|
285 |
+
"metadata": {
|
286 |
+
"colab": {
|
287 |
+
"base_uri": "https://localhost:8080/"
|
288 |
+
},
|
289 |
+
"id": "yW3gI56q5x9B",
|
290 |
+
"outputId": "20280982-d21a-494a-915b-a554c5f76573"
|
291 |
+
},
|
292 |
+
"execution_count": 7,
|
293 |
+
"outputs": [
|
294 |
+
{
|
295 |
+
"output_type": "stream",
|
296 |
+
"name": "stdout",
|
297 |
+
"text": [
|
298 |
+
"Downloading spotgen-music-dataset.zip to /content\n",
|
299 |
+
"100% 273M/274M [00:18<00:00, 23.0MB/s]\n",
|
300 |
+
"100% 274M/274M [00:18<00:00, 15.9MB/s]\n"
|
301 |
+
]
|
302 |
+
}
|
303 |
+
]
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"cell_type": "code",
|
307 |
+
"source": [
|
308 |
+
"!pip install patool"
|
309 |
+
],
|
310 |
+
"metadata": {
|
311 |
+
"colab": {
|
312 |
+
"base_uri": "https://localhost:8080/"
|
313 |
+
},
|
314 |
+
"id": "eIsVsVF_57MO",
|
315 |
+
"outputId": "4a4de23c-f8b2-48ae-c7da-2483b79b0358"
|
316 |
+
},
|
317 |
+
"execution_count": 8,
|
318 |
+
"outputs": [
|
319 |
+
{
|
320 |
+
"output_type": "stream",
|
321 |
+
"name": "stdout",
|
322 |
+
"text": [
|
323 |
+
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
324 |
+
"Collecting patool\n",
|
325 |
+
" Downloading patool-1.12-py2.py3-none-any.whl (77 kB)\n",
|
326 |
+
"\u001b[K |████████████████████████████████| 77 kB 3.0 MB/s \n",
|
327 |
+
"\u001b[?25hInstalling collected packages: patool\n",
|
328 |
+
"Successfully installed patool-1.12\n"
|
329 |
+
]
|
330 |
+
}
|
331 |
+
]
|
332 |
+
},
|
333 |
+
{
|
334 |
+
"cell_type": "code",
|
335 |
+
"source": [
|
336 |
+
"import patoolib"
|
337 |
+
],
|
338 |
+
"metadata": {
|
339 |
+
"id": "y5kv8NsL59W6"
|
340 |
+
},
|
341 |
+
"execution_count": 9,
|
342 |
+
"outputs": []
|
343 |
+
},
|
344 |
+
{
|
345 |
+
"cell_type": "code",
|
346 |
+
"source": [
|
347 |
+
"patoolib.extract_archive('spotgen-music-dataset.zip')"
|
348 |
+
],
|
349 |
+
"metadata": {
|
350 |
+
"colab": {
|
351 |
+
"base_uri": "https://localhost:8080/",
|
352 |
+
"height": 88
|
353 |
+
},
|
354 |
+
"id": "CCM-qXKe5_Km",
|
355 |
+
"outputId": "f2c3ac9f-c1ab-4997-ed11-d318f2967d3c"
|
356 |
+
},
|
357 |
+
"execution_count": 10,
|
358 |
+
"outputs": [
|
359 |
+
{
|
360 |
+
"output_type": "stream",
|
361 |
+
"name": "stdout",
|
362 |
+
"text": [
|
363 |
+
"patool: Extracting spotgen-music-dataset.zip ...\n",
|
364 |
+
"patool: running /usr/bin/7z x -o./Unpack_51crkv6y -- spotgen-music-dataset.zip\n",
|
365 |
+
"patool: ... spotgen-music-dataset.zip extracted to `SpotGenTrack'.\n"
|
366 |
+
]
|
367 |
+
},
|
368 |
+
{
|
369 |
+
"output_type": "execute_result",
|
370 |
+
"data": {
|
371 |
+
"text/plain": [
|
372 |
+
"'SpotGenTrack'"
|
373 |
+
],
|
374 |
+
"application/vnd.google.colaboratory.intrinsic+json": {
|
375 |
+
"type": "string"
|
376 |
+
}
|
377 |
+
},
|
378 |
+
"metadata": {},
|
379 |
+
"execution_count": 10
|
380 |
+
}
|
381 |
+
]
|
382 |
+
},
|
383 |
+
{
|
384 |
+
"cell_type": "code",
|
385 |
+
"source": [
|
386 |
+
"data_dir = \"SpotGenTrack/Data Sources/\"\n",
|
387 |
+
"albums_data = pd.read_csv(data_dir + \"spotify_albums.csv\")\n",
|
388 |
+
"artists_data = pd.read_csv(data_dir + \"spotify_artists.csv\")\n",
|
389 |
+
"tracks_data = pd.read_csv(data_dir + \"spotify_tracks.csv\")"
|
390 |
+
],
|
391 |
+
"metadata": {
|
392 |
+
"id": "q5JCr7WS5XiT"
|
393 |
+
},
|
394 |
+
"execution_count": 11,
|
395 |
+
"outputs": []
|
396 |
+
},
|
397 |
+
{
|
398 |
+
"cell_type": "code",
|
399 |
+
"source": [
|
400 |
+
"display(albums_data.head())\n",
|
401 |
+
"albums_data.columns"
|
402 |
+
],
|
403 |
+
"metadata": {
|
404 |
+
"colab": {
|
405 |
+
"base_uri": "https://localhost:8080/",
|
406 |
+
"height": 582
|
407 |
+
},
|
408 |
+
"id": "rrQEjWwK6W2g",
|
409 |
+
"outputId": "984e20a8-720e-475c-b97d-23aebb518c4e"
|
410 |
+
},
|
411 |
+
"execution_count": 12,
|
412 |
+
"outputs": [
|
413 |
+
{
|
414 |
+
"output_type": "display_data",
|
415 |
+
"data": {
|
416 |
+
"text/plain": [
|
417 |
+
" Unnamed: 0 album_type artist_id \\\n",
|
418 |
+
"0 0 single 3DiDSECUqqY1AuBP8qtaIa \n",
|
419 |
+
"1 1 album 6s1pCNXcbdtQJlsnM1hRIA \n",
|
420 |
+
"2 2 single 5YjfNaHq05WrwldRe1QSBc \n",
|
421 |
+
"3 3 single 2G9Vc16JCpnZmK4uGH46Fa \n",
|
422 |
+
"4 4 single 2dwM9OcE4c3Ph1UBINSodx \n",
|
423 |
+
"\n",
|
424 |
+
" available_markets \\\n",
|
425 |
+
"0 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... \n",
|
426 |
+
"1 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... \n",
|
427 |
+
"2 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... \n",
|
428 |
+
"3 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... \n",
|
429 |
+
"4 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... \n",
|
430 |
+
"\n",
|
431 |
+
" external_urls \\\n",
|
432 |
+
"0 {'spotify': 'https://open.spotify.com/album/1g... \n",
|
433 |
+
"1 {'spotify': 'https://open.spotify.com/album/4K... \n",
|
434 |
+
"2 {'spotify': 'https://open.spotify.com/album/7n... \n",
|
435 |
+
"3 {'spotify': 'https://open.spotify.com/album/6p... \n",
|
436 |
+
"4 {'spotify': 'https://open.spotify.com/album/1X... \n",
|
437 |
+
"\n",
|
438 |
+
" href id \\\n",
|
439 |
+
"0 https://api.spotify.com/v1/albums/1gAM7M4rBwEb... 1gAM7M4rBwEbSPeAQR2nx1 \n",
|
440 |
+
"1 https://api.spotify.com/v1/albums/4KfJZV7WfolY... 4KfJZV7WfolYlxBzOTo66s \n",
|
441 |
+
"2 https://api.spotify.com/v1/albums/7nLYY7uAVUb5... 7nLYY7uAVUb57kpd7tZxnS \n",
|
442 |
+
"3 https://api.spotify.com/v1/albums/6p20Rt4x2Qn5... 6p20Rt4x2Qn5mUMRi1s6pj \n",
|
443 |
+
"4 https://api.spotify.com/v1/albums/1XeoOqC1q7U2... 1XeoOqC1q7U2iyLEQJ64cu \n",
|
444 |
+
"\n",
|
445 |
+
" images \\\n",
|
446 |
+
"0 [{'height': 640, 'url': 'https://i.scdn.co/ima... \n",
|
447 |
+
"1 [{'height': 640, 'url': 'https://i.scdn.co/ima... \n",
|
448 |
+
"2 [{'height': 640, 'url': 'https://i.scdn.co/ima... \n",
|
449 |
+
"3 [{'height': 640, 'url': 'https://i.scdn.co/ima... \n",
|
450 |
+
"4 [{'height': 640, 'url': 'https://i.scdn.co/ima... \n",
|
451 |
+
"\n",
|
452 |
+
" name release_date \\\n",
|
453 |
+
"0 If I Ain't Got You EP 2019-02-08 \n",
|
454 |
+
"1 Shostakovich Symphony No.5 - Four Romances on ... 2019-03-01 \n",
|
455 |
+
"2 Take My Bass 2019-03-14 \n",
|
456 |
+
"3 Hypnotizing (Are U) 2016-11-16 \n",
|
457 |
+
"4 Sunshine 2018-07-20 \n",
|
458 |
+
"\n",
|
459 |
+
" release_date_precision total_tracks track_id \\\n",
|
460 |
+
"0 day 6 2iejTMy9XZ8Gaae0aQ2yl0 \n",
|
461 |
+
"1 day 8 1WQfghEjszJJ4H8MAWrQ2C \n",
|
462 |
+
"2 day 1 3jJKj4QTK3v18ZSwpk7AcV \n",
|
463 |
+
"3 day 1 1xGtDafUZbHyYC3Xarcbrj \n",
|
464 |
+
"4 day 1 0gWtsXvXOzAT6FtM3ur8in \n",
|
465 |
+
"\n",
|
466 |
+
" track_name_prev uri type \n",
|
467 |
+
"0 track_32 spotify:album:1gAM7M4rBwEbSPeAQR2nx1 album \n",
|
468 |
+
"1 track_11 spotify:album:4KfJZV7WfolYlxBzOTo66s album \n",
|
469 |
+
"2 track_15 spotify:album:7nLYY7uAVUb57kpd7tZxnS album \n",
|
470 |
+
"3 track_46 spotify:album:6p20Rt4x2Qn5mUMRi1s6pj album \n",
|
471 |
+
"4 track_10 spotify:album:1XeoOqC1q7U2iyLEQJ64cu album "
|
472 |
+
],
|
473 |
+
"text/html": [
|
474 |
+
"\n",
|
475 |
+
" <div id=\"df-eabe1c5a-d6e1-4b7b-83a0-6578c7fa299e\">\n",
|
476 |
+
" <div class=\"colab-df-container\">\n",
|
477 |
+
" <div>\n",
|
478 |
+
"<style scoped>\n",
|
479 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
480 |
+
" vertical-align: middle;\n",
|
481 |
+
" }\n",
|
482 |
+
"\n",
|
483 |
+
" .dataframe tbody tr th {\n",
|
484 |
+
" vertical-align: top;\n",
|
485 |
+
" }\n",
|
486 |
+
"\n",
|
487 |
+
" .dataframe thead th {\n",
|
488 |
+
" text-align: right;\n",
|
489 |
+
" }\n",
|
490 |
+
"</style>\n",
|
491 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
492 |
+
" <thead>\n",
|
493 |
+
" <tr style=\"text-align: right;\">\n",
|
494 |
+
" <th></th>\n",
|
495 |
+
" <th>Unnamed: 0</th>\n",
|
496 |
+
" <th>album_type</th>\n",
|
497 |
+
" <th>artist_id</th>\n",
|
498 |
+
" <th>available_markets</th>\n",
|
499 |
+
" <th>external_urls</th>\n",
|
500 |
+
" <th>href</th>\n",
|
501 |
+
" <th>id</th>\n",
|
502 |
+
" <th>images</th>\n",
|
503 |
+
" <th>name</th>\n",
|
504 |
+
" <th>release_date</th>\n",
|
505 |
+
" <th>release_date_precision</th>\n",
|
506 |
+
" <th>total_tracks</th>\n",
|
507 |
+
" <th>track_id</th>\n",
|
508 |
+
" <th>track_name_prev</th>\n",
|
509 |
+
" <th>uri</th>\n",
|
510 |
+
" <th>type</th>\n",
|
511 |
+
" </tr>\n",
|
512 |
+
" </thead>\n",
|
513 |
+
" <tbody>\n",
|
514 |
+
" <tr>\n",
|
515 |
+
" <th>0</th>\n",
|
516 |
+
" <td>0</td>\n",
|
517 |
+
" <td>single</td>\n",
|
518 |
+
" <td>3DiDSECUqqY1AuBP8qtaIa</td>\n",
|
519 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
520 |
+
" <td>{'spotify': 'https://open.spotify.com/album/1g...</td>\n",
|
521 |
+
" <td>https://api.spotify.com/v1/albums/1gAM7M4rBwEb...</td>\n",
|
522 |
+
" <td>1gAM7M4rBwEbSPeAQR2nx1</td>\n",
|
523 |
+
" <td>[{'height': 640, 'url': 'https://i.scdn.co/ima...</td>\n",
|
524 |
+
" <td>If I Ain't Got You EP</td>\n",
|
525 |
+
" <td>2019-02-08</td>\n",
|
526 |
+
" <td>day</td>\n",
|
527 |
+
" <td>6</td>\n",
|
528 |
+
" <td>2iejTMy9XZ8Gaae0aQ2yl0</td>\n",
|
529 |
+
" <td>track_32</td>\n",
|
530 |
+
" <td>spotify:album:1gAM7M4rBwEbSPeAQR2nx1</td>\n",
|
531 |
+
" <td>album</td>\n",
|
532 |
+
" </tr>\n",
|
533 |
+
" <tr>\n",
|
534 |
+
" <th>1</th>\n",
|
535 |
+
" <td>1</td>\n",
|
536 |
+
" <td>album</td>\n",
|
537 |
+
" <td>6s1pCNXcbdtQJlsnM1hRIA</td>\n",
|
538 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
539 |
+
" <td>{'spotify': 'https://open.spotify.com/album/4K...</td>\n",
|
540 |
+
" <td>https://api.spotify.com/v1/albums/4KfJZV7WfolY...</td>\n",
|
541 |
+
" <td>4KfJZV7WfolYlxBzOTo66s</td>\n",
|
542 |
+
" <td>[{'height': 640, 'url': 'https://i.scdn.co/ima...</td>\n",
|
543 |
+
" <td>Shostakovich Symphony No.5 - Four Romances on ...</td>\n",
|
544 |
+
" <td>2019-03-01</td>\n",
|
545 |
+
" <td>day</td>\n",
|
546 |
+
" <td>8</td>\n",
|
547 |
+
" <td>1WQfghEjszJJ4H8MAWrQ2C</td>\n",
|
548 |
+
" <td>track_11</td>\n",
|
549 |
+
" <td>spotify:album:4KfJZV7WfolYlxBzOTo66s</td>\n",
|
550 |
+
" <td>album</td>\n",
|
551 |
+
" </tr>\n",
|
552 |
+
" <tr>\n",
|
553 |
+
" <th>2</th>\n",
|
554 |
+
" <td>2</td>\n",
|
555 |
+
" <td>single</td>\n",
|
556 |
+
" <td>5YjfNaHq05WrwldRe1QSBc</td>\n",
|
557 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
558 |
+
" <td>{'spotify': 'https://open.spotify.com/album/7n...</td>\n",
|
559 |
+
" <td>https://api.spotify.com/v1/albums/7nLYY7uAVUb5...</td>\n",
|
560 |
+
" <td>7nLYY7uAVUb57kpd7tZxnS</td>\n",
|
561 |
+
" <td>[{'height': 640, 'url': 'https://i.scdn.co/ima...</td>\n",
|
562 |
+
" <td>Take My Bass</td>\n",
|
563 |
+
" <td>2019-03-14</td>\n",
|
564 |
+
" <td>day</td>\n",
|
565 |
+
" <td>1</td>\n",
|
566 |
+
" <td>3jJKj4QTK3v18ZSwpk7AcV</td>\n",
|
567 |
+
" <td>track_15</td>\n",
|
568 |
+
" <td>spotify:album:7nLYY7uAVUb57kpd7tZxnS</td>\n",
|
569 |
+
" <td>album</td>\n",
|
570 |
+
" </tr>\n",
|
571 |
+
" <tr>\n",
|
572 |
+
" <th>3</th>\n",
|
573 |
+
" <td>3</td>\n",
|
574 |
+
" <td>single</td>\n",
|
575 |
+
" <td>2G9Vc16JCpnZmK4uGH46Fa</td>\n",
|
576 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
577 |
+
" <td>{'spotify': 'https://open.spotify.com/album/6p...</td>\n",
|
578 |
+
" <td>https://api.spotify.com/v1/albums/6p20Rt4x2Qn5...</td>\n",
|
579 |
+
" <td>6p20Rt4x2Qn5mUMRi1s6pj</td>\n",
|
580 |
+
" <td>[{'height': 640, 'url': 'https://i.scdn.co/ima...</td>\n",
|
581 |
+
" <td>Hypnotizing (Are U)</td>\n",
|
582 |
+
" <td>2016-11-16</td>\n",
|
583 |
+
" <td>day</td>\n",
|
584 |
+
" <td>1</td>\n",
|
585 |
+
" <td>1xGtDafUZbHyYC3Xarcbrj</td>\n",
|
586 |
+
" <td>track_46</td>\n",
|
587 |
+
" <td>spotify:album:6p20Rt4x2Qn5mUMRi1s6pj</td>\n",
|
588 |
+
" <td>album</td>\n",
|
589 |
+
" </tr>\n",
|
590 |
+
" <tr>\n",
|
591 |
+
" <th>4</th>\n",
|
592 |
+
" <td>4</td>\n",
|
593 |
+
" <td>single</td>\n",
|
594 |
+
" <td>2dwM9OcE4c3Ph1UBINSodx</td>\n",
|
595 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
596 |
+
" <td>{'spotify': 'https://open.spotify.com/album/1X...</td>\n",
|
597 |
+
" <td>https://api.spotify.com/v1/albums/1XeoOqC1q7U2...</td>\n",
|
598 |
+
" <td>1XeoOqC1q7U2iyLEQJ64cu</td>\n",
|
599 |
+
" <td>[{'height': 640, 'url': 'https://i.scdn.co/ima...</td>\n",
|
600 |
+
" <td>Sunshine</td>\n",
|
601 |
+
" <td>2018-07-20</td>\n",
|
602 |
+
" <td>day</td>\n",
|
603 |
+
" <td>1</td>\n",
|
604 |
+
" <td>0gWtsXvXOzAT6FtM3ur8in</td>\n",
|
605 |
+
" <td>track_10</td>\n",
|
606 |
+
" <td>spotify:album:1XeoOqC1q7U2iyLEQJ64cu</td>\n",
|
607 |
+
" <td>album</td>\n",
|
608 |
+
" </tr>\n",
|
609 |
+
" </tbody>\n",
|
610 |
+
"</table>\n",
|
611 |
+
"</div>\n",
|
612 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-eabe1c5a-d6e1-4b7b-83a0-6578c7fa299e')\"\n",
|
613 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
614 |
+
" style=\"display:none;\">\n",
|
615 |
+
" \n",
|
616 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
617 |
+
" width=\"24px\">\n",
|
618 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
619 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
620 |
+
" </svg>\n",
|
621 |
+
" </button>\n",
|
622 |
+
" \n",
|
623 |
+
" <style>\n",
|
624 |
+
" .colab-df-container {\n",
|
625 |
+
" display:flex;\n",
|
626 |
+
" flex-wrap:wrap;\n",
|
627 |
+
" gap: 12px;\n",
|
628 |
+
" }\n",
|
629 |
+
"\n",
|
630 |
+
" .colab-df-convert {\n",
|
631 |
+
" background-color: #E8F0FE;\n",
|
632 |
+
" border: none;\n",
|
633 |
+
" border-radius: 50%;\n",
|
634 |
+
" cursor: pointer;\n",
|
635 |
+
" display: none;\n",
|
636 |
+
" fill: #1967D2;\n",
|
637 |
+
" height: 32px;\n",
|
638 |
+
" padding: 0 0 0 0;\n",
|
639 |
+
" width: 32px;\n",
|
640 |
+
" }\n",
|
641 |
+
"\n",
|
642 |
+
" .colab-df-convert:hover {\n",
|
643 |
+
" background-color: #E2EBFA;\n",
|
644 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
645 |
+
" fill: #174EA6;\n",
|
646 |
+
" }\n",
|
647 |
+
"\n",
|
648 |
+
" [theme=dark] .colab-df-convert {\n",
|
649 |
+
" background-color: #3B4455;\n",
|
650 |
+
" fill: #D2E3FC;\n",
|
651 |
+
" }\n",
|
652 |
+
"\n",
|
653 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
654 |
+
" background-color: #434B5C;\n",
|
655 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
656 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
657 |
+
" fill: #FFFFFF;\n",
|
658 |
+
" }\n",
|
659 |
+
" </style>\n",
|
660 |
+
"\n",
|
661 |
+
" <script>\n",
|
662 |
+
" const buttonEl =\n",
|
663 |
+
" document.querySelector('#df-eabe1c5a-d6e1-4b7b-83a0-6578c7fa299e button.colab-df-convert');\n",
|
664 |
+
" buttonEl.style.display =\n",
|
665 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
666 |
+
"\n",
|
667 |
+
" async function convertToInteractive(key) {\n",
|
668 |
+
" const element = document.querySelector('#df-eabe1c5a-d6e1-4b7b-83a0-6578c7fa299e');\n",
|
669 |
+
" const dataTable =\n",
|
670 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
671 |
+
" [key], {});\n",
|
672 |
+
" if (!dataTable) return;\n",
|
673 |
+
"\n",
|
674 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
675 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
676 |
+
" + ' to learn more about interactive tables.';\n",
|
677 |
+
" element.innerHTML = '';\n",
|
678 |
+
" dataTable['output_type'] = 'display_data';\n",
|
679 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
680 |
+
" const docLink = document.createElement('div');\n",
|
681 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
682 |
+
" element.appendChild(docLink);\n",
|
683 |
+
" }\n",
|
684 |
+
" </script>\n",
|
685 |
+
" </div>\n",
|
686 |
+
" </div>\n",
|
687 |
+
" "
|
688 |
+
]
|
689 |
+
},
|
690 |
+
"metadata": {}
|
691 |
+
},
|
692 |
+
{
|
693 |
+
"output_type": "execute_result",
|
694 |
+
"data": {
|
695 |
+
"text/plain": [
|
696 |
+
"Index(['Unnamed: 0', 'album_type', 'artist_id', 'available_markets',\n",
|
697 |
+
" 'external_urls', 'href', 'id', 'images', 'name', 'release_date',\n",
|
698 |
+
" 'release_date_precision', 'total_tracks', 'track_id', 'track_name_prev',\n",
|
699 |
+
" 'uri', 'type'],\n",
|
700 |
+
" dtype='object')"
|
701 |
+
]
|
702 |
+
},
|
703 |
+
"metadata": {},
|
704 |
+
"execution_count": 12
|
705 |
+
}
|
706 |
+
]
|
707 |
+
},
|
708 |
+
{
|
709 |
+
"cell_type": "code",
|
710 |
+
"source": [
|
711 |
+
"display(artists_data.head())\n",
|
712 |
+
"artists_data.columns"
|
713 |
+
],
|
714 |
+
"metadata": {
|
715 |
+
"colab": {
|
716 |
+
"base_uri": "https://localhost:8080/",
|
717 |
+
"height": 258
|
718 |
+
},
|
719 |
+
"id": "tAHuaO606Yjd",
|
720 |
+
"outputId": "e9feccbe-990f-444a-a16d-b00f9d0cceea"
|
721 |
+
},
|
722 |
+
"execution_count": 13,
|
723 |
+
"outputs": [
|
724 |
+
{
|
725 |
+
"output_type": "display_data",
|
726 |
+
"data": {
|
727 |
+
"text/plain": [
|
728 |
+
" Unnamed: 0 artist_popularity followers \\\n",
|
729 |
+
"0 0 44 23230 \n",
|
730 |
+
"1 1 22 313 \n",
|
731 |
+
"2 2 26 1596 \n",
|
732 |
+
"3 3 31 149 \n",
|
733 |
+
"4 4 21 11 \n",
|
734 |
+
"\n",
|
735 |
+
" genres id \\\n",
|
736 |
+
"0 ['sertanejo', 'sertanejo pop', 'sertanejo trad... 4mGnpjhqgx4RUdsIJiURdo \n",
|
737 |
+
"1 [] 1dLnVku4VQUOLswwDFvRc9 \n",
|
738 |
+
"2 ['danish pop rock'] 6YVY310fjfUzKi8hiqR7iK \n",
|
739 |
+
"3 ['uk alternative pop'] 2VElyouiCfoYPDJluzwJwK \n",
|
740 |
+
"4 ['french baroque'] 4agVy03qW8juSysCTUOuDI \n",
|
741 |
+
"\n",
|
742 |
+
" name track_id track_name_prev type \n",
|
743 |
+
"0 Juliano Cezar 0wmDmAILuW9e2aRttkl4aC track_9 artist \n",
|
744 |
+
"1 The Grenadines 4wqwj0gA8qPZKLl5WVqXml track_30 artist \n",
|
745 |
+
"2 Gangway 1bFqWDbvHmZe2f4Nf9qaD8 track_38 artist \n",
|
746 |
+
"3 FADES 3MFSUBAidPzRBbIS7BDj1S track_34 artist \n",
|
747 |
+
"4 Jean-Pierre Guignon 2r3q57FhxdsCyYr0kuDq4b track_26 artist "
|
748 |
+
],
|
749 |
+
"text/html": [
|
750 |
+
"\n",
|
751 |
+
" <div id=\"df-d959edf2-79c3-4736-8a38-326b6c0d0f2d\">\n",
|
752 |
+
" <div class=\"colab-df-container\">\n",
|
753 |
+
" <div>\n",
|
754 |
+
"<style scoped>\n",
|
755 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
756 |
+
" vertical-align: middle;\n",
|
757 |
+
" }\n",
|
758 |
+
"\n",
|
759 |
+
" .dataframe tbody tr th {\n",
|
760 |
+
" vertical-align: top;\n",
|
761 |
+
" }\n",
|
762 |
+
"\n",
|
763 |
+
" .dataframe thead th {\n",
|
764 |
+
" text-align: right;\n",
|
765 |
+
" }\n",
|
766 |
+
"</style>\n",
|
767 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
768 |
+
" <thead>\n",
|
769 |
+
" <tr style=\"text-align: right;\">\n",
|
770 |
+
" <th></th>\n",
|
771 |
+
" <th>Unnamed: 0</th>\n",
|
772 |
+
" <th>artist_popularity</th>\n",
|
773 |
+
" <th>followers</th>\n",
|
774 |
+
" <th>genres</th>\n",
|
775 |
+
" <th>id</th>\n",
|
776 |
+
" <th>name</th>\n",
|
777 |
+
" <th>track_id</th>\n",
|
778 |
+
" <th>track_name_prev</th>\n",
|
779 |
+
" <th>type</th>\n",
|
780 |
+
" </tr>\n",
|
781 |
+
" </thead>\n",
|
782 |
+
" <tbody>\n",
|
783 |
+
" <tr>\n",
|
784 |
+
" <th>0</th>\n",
|
785 |
+
" <td>0</td>\n",
|
786 |
+
" <td>44</td>\n",
|
787 |
+
" <td>23230</td>\n",
|
788 |
+
" <td>['sertanejo', 'sertanejo pop', 'sertanejo trad...</td>\n",
|
789 |
+
" <td>4mGnpjhqgx4RUdsIJiURdo</td>\n",
|
790 |
+
" <td>Juliano Cezar</td>\n",
|
791 |
+
" <td>0wmDmAILuW9e2aRttkl4aC</td>\n",
|
792 |
+
" <td>track_9</td>\n",
|
793 |
+
" <td>artist</td>\n",
|
794 |
+
" </tr>\n",
|
795 |
+
" <tr>\n",
|
796 |
+
" <th>1</th>\n",
|
797 |
+
" <td>1</td>\n",
|
798 |
+
" <td>22</td>\n",
|
799 |
+
" <td>313</td>\n",
|
800 |
+
" <td>[]</td>\n",
|
801 |
+
" <td>1dLnVku4VQUOLswwDFvRc9</td>\n",
|
802 |
+
" <td>The Grenadines</td>\n",
|
803 |
+
" <td>4wqwj0gA8qPZKLl5WVqXml</td>\n",
|
804 |
+
" <td>track_30</td>\n",
|
805 |
+
" <td>artist</td>\n",
|
806 |
+
" </tr>\n",
|
807 |
+
" <tr>\n",
|
808 |
+
" <th>2</th>\n",
|
809 |
+
" <td>2</td>\n",
|
810 |
+
" <td>26</td>\n",
|
811 |
+
" <td>1596</td>\n",
|
812 |
+
" <td>['danish pop rock']</td>\n",
|
813 |
+
" <td>6YVY310fjfUzKi8hiqR7iK</td>\n",
|
814 |
+
" <td>Gangway</td>\n",
|
815 |
+
" <td>1bFqWDbvHmZe2f4Nf9qaD8</td>\n",
|
816 |
+
" <td>track_38</td>\n",
|
817 |
+
" <td>artist</td>\n",
|
818 |
+
" </tr>\n",
|
819 |
+
" <tr>\n",
|
820 |
+
" <th>3</th>\n",
|
821 |
+
" <td>3</td>\n",
|
822 |
+
" <td>31</td>\n",
|
823 |
+
" <td>149</td>\n",
|
824 |
+
" <td>['uk alternative pop']</td>\n",
|
825 |
+
" <td>2VElyouiCfoYPDJluzwJwK</td>\n",
|
826 |
+
" <td>FADES</td>\n",
|
827 |
+
" <td>3MFSUBAidPzRBbIS7BDj1S</td>\n",
|
828 |
+
" <td>track_34</td>\n",
|
829 |
+
" <td>artist</td>\n",
|
830 |
+
" </tr>\n",
|
831 |
+
" <tr>\n",
|
832 |
+
" <th>4</th>\n",
|
833 |
+
" <td>4</td>\n",
|
834 |
+
" <td>21</td>\n",
|
835 |
+
" <td>11</td>\n",
|
836 |
+
" <td>['french baroque']</td>\n",
|
837 |
+
" <td>4agVy03qW8juSysCTUOuDI</td>\n",
|
838 |
+
" <td>Jean-Pierre Guignon</td>\n",
|
839 |
+
" <td>2r3q57FhxdsCyYr0kuDq4b</td>\n",
|
840 |
+
" <td>track_26</td>\n",
|
841 |
+
" <td>artist</td>\n",
|
842 |
+
" </tr>\n",
|
843 |
+
" </tbody>\n",
|
844 |
+
"</table>\n",
|
845 |
+
"</div>\n",
|
846 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d959edf2-79c3-4736-8a38-326b6c0d0f2d')\"\n",
|
847 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
848 |
+
" style=\"display:none;\">\n",
|
849 |
+
" \n",
|
850 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
851 |
+
" width=\"24px\">\n",
|
852 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
853 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
854 |
+
" </svg>\n",
|
855 |
+
" </button>\n",
|
856 |
+
" \n",
|
857 |
+
" <style>\n",
|
858 |
+
" .colab-df-container {\n",
|
859 |
+
" display:flex;\n",
|
860 |
+
" flex-wrap:wrap;\n",
|
861 |
+
" gap: 12px;\n",
|
862 |
+
" }\n",
|
863 |
+
"\n",
|
864 |
+
" .colab-df-convert {\n",
|
865 |
+
" background-color: #E8F0FE;\n",
|
866 |
+
" border: none;\n",
|
867 |
+
" border-radius: 50%;\n",
|
868 |
+
" cursor: pointer;\n",
|
869 |
+
" display: none;\n",
|
870 |
+
" fill: #1967D2;\n",
|
871 |
+
" height: 32px;\n",
|
872 |
+
" padding: 0 0 0 0;\n",
|
873 |
+
" width: 32px;\n",
|
874 |
+
" }\n",
|
875 |
+
"\n",
|
876 |
+
" .colab-df-convert:hover {\n",
|
877 |
+
" background-color: #E2EBFA;\n",
|
878 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
879 |
+
" fill: #174EA6;\n",
|
880 |
+
" }\n",
|
881 |
+
"\n",
|
882 |
+
" [theme=dark] .colab-df-convert {\n",
|
883 |
+
" background-color: #3B4455;\n",
|
884 |
+
" fill: #D2E3FC;\n",
|
885 |
+
" }\n",
|
886 |
+
"\n",
|
887 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
888 |
+
" background-color: #434B5C;\n",
|
889 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
890 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
891 |
+
" fill: #FFFFFF;\n",
|
892 |
+
" }\n",
|
893 |
+
" </style>\n",
|
894 |
+
"\n",
|
895 |
+
" <script>\n",
|
896 |
+
" const buttonEl =\n",
|
897 |
+
" document.querySelector('#df-d959edf2-79c3-4736-8a38-326b6c0d0f2d button.colab-df-convert');\n",
|
898 |
+
" buttonEl.style.display =\n",
|
899 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
900 |
+
"\n",
|
901 |
+
" async function convertToInteractive(key) {\n",
|
902 |
+
" const element = document.querySelector('#df-d959edf2-79c3-4736-8a38-326b6c0d0f2d');\n",
|
903 |
+
" const dataTable =\n",
|
904 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
905 |
+
" [key], {});\n",
|
906 |
+
" if (!dataTable) return;\n",
|
907 |
+
"\n",
|
908 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
909 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
910 |
+
" + ' to learn more about interactive tables.';\n",
|
911 |
+
" element.innerHTML = '';\n",
|
912 |
+
" dataTable['output_type'] = 'display_data';\n",
|
913 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
914 |
+
" const docLink = document.createElement('div');\n",
|
915 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
916 |
+
" element.appendChild(docLink);\n",
|
917 |
+
" }\n",
|
918 |
+
" </script>\n",
|
919 |
+
" </div>\n",
|
920 |
+
" </div>\n",
|
921 |
+
" "
|
922 |
+
]
|
923 |
+
},
|
924 |
+
"metadata": {}
|
925 |
+
},
|
926 |
+
{
|
927 |
+
"output_type": "execute_result",
|
928 |
+
"data": {
|
929 |
+
"text/plain": [
|
930 |
+
"Index(['Unnamed: 0', 'artist_popularity', 'followers', 'genres', 'id', 'name',\n",
|
931 |
+
" 'track_id', 'track_name_prev', 'type'],\n",
|
932 |
+
" dtype='object')"
|
933 |
+
]
|
934 |
+
},
|
935 |
+
"metadata": {},
|
936 |
+
"execution_count": 13
|
937 |
+
}
|
938 |
+
]
|
939 |
+
},
|
940 |
+
{
|
941 |
+
"cell_type": "code",
|
942 |
+
"source": [
|
943 |
+
"display(tracks_data.head())\n",
|
944 |
+
"tracks_data.columns"
|
945 |
+
],
|
946 |
+
"metadata": {
|
947 |
+
"colab": {
|
948 |
+
"base_uri": "https://localhost:8080/",
|
949 |
+
"height": 594
|
950 |
+
},
|
951 |
+
"id": "OCjiZZnD6a0U",
|
952 |
+
"outputId": "3108dda2-b5a0-476d-9c1f-c61f58e8a396"
|
953 |
+
},
|
954 |
+
"execution_count": 14,
|
955 |
+
"outputs": [
|
956 |
+
{
|
957 |
+
"output_type": "display_data",
|
958 |
+
"data": {
|
959 |
+
"text/plain": [
|
960 |
+
" Unnamed: 0 acousticness album_id \\\n",
|
961 |
+
"0 0 0.294 0D3QufeCudpQANOR7luqdr \n",
|
962 |
+
"1 1 0.863 1bcqsH5UyTBzmh9YizdsBE \n",
|
963 |
+
"2 2 0.750 4tKijjmxGClg4JOLAyo2qE \n",
|
964 |
+
"3 3 0.763 6FeJF5r8roonnKraJxr4oB \n",
|
965 |
+
"4 4 0.770 4tKijjmxGClg4JOLAyo2qE \n",
|
966 |
+
"\n",
|
967 |
+
" analysis_url \\\n",
|
968 |
+
"0 https://api.spotify.com/v1/audio-analysis/5qlj... \n",
|
969 |
+
"1 https://api.spotify.com/v1/audio-analysis/3VAX... \n",
|
970 |
+
"2 https://api.spotify.com/v1/audio-analysis/1L3Y... \n",
|
971 |
+
"3 https://api.spotify.com/v1/audio-analysis/6aCe... \n",
|
972 |
+
"4 https://api.spotify.com/v1/audio-analysis/1Vo8... \n",
|
973 |
+
"\n",
|
974 |
+
" artists_id \\\n",
|
975 |
+
"0 ['3mxJuHRn2ZWD5OofvJtDZY'] \n",
|
976 |
+
"1 ['4xWMewm6CYMstu0sPgd9jJ'] \n",
|
977 |
+
"2 ['3hYaK5FF3YAglCj5HZgBnP'] \n",
|
978 |
+
"3 ['2KQsUB9DRBcJk17JWX1eXD'] \n",
|
979 |
+
"4 ['3hYaK5FF3YAglCj5HZgBnP'] \n",
|
980 |
+
"\n",
|
981 |
+
" available_markets country danceability \\\n",
|
982 |
+
"0 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... BE 0.698 \n",
|
983 |
+
"1 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... BE 0.719 \n",
|
984 |
+
"2 ['GB'] BE 0.466 \n",
|
985 |
+
"3 ['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH... BE 0.719 \n",
|
986 |
+
"4 ['GB'] BE 0.460 \n",
|
987 |
+
"\n",
|
988 |
+
" disc_number duration_ms ... \\\n",
|
989 |
+
"0 1.0 235584.0 ... \n",
|
990 |
+
"1 1.0 656960.0 ... \n",
|
991 |
+
"2 1.0 492840.0 ... \n",
|
992 |
+
"3 1.0 316578.0 ... \n",
|
993 |
+
"4 1.0 558880.0 ... \n",
|
994 |
+
"\n",
|
995 |
+
" preview_url speechiness tempo \\\n",
|
996 |
+
"0 https://p.scdn.co/mp3-preview/1b05a902da3a251d... 0.0262 115.018 \n",
|
997 |
+
"1 https://p.scdn.co/mp3-preview/d8140736a6131cb5... 0.9220 115.075 \n",
|
998 |
+
"2 https://p.scdn.co/mp3-preview/c8af28fb15185b18... 0.9440 79.565 \n",
|
999 |
+
"3 https://p.scdn.co/mp3-preview/7629b8e9f31f6e9b... 0.9380 112.822 \n",
|
1000 |
+
"4 https://p.scdn.co/mp3-preview/32be593c0eb82868... 0.9430 81.260 \n",
|
1001 |
+
"\n",
|
1002 |
+
" time_signature track_href \\\n",
|
1003 |
+
"0 4.0 https://api.spotify.com/v1/tracks/5qljLQuKnNJf... \n",
|
1004 |
+
"1 3.0 https://api.spotify.com/v1/tracks/3VAX2MJdmdqA... \n",
|
1005 |
+
"2 4.0 https://api.spotify.com/v1/tracks/1L3YAhsEMrGV... \n",
|
1006 |
+
"3 3.0 https://api.spotify.com/v1/tracks/6aCe9zzoZmCo... \n",
|
1007 |
+
"4 4.0 https://api.spotify.com/v1/tracks/1Vo802A38tPF... \n",
|
1008 |
+
"\n",
|
1009 |
+
" track_name_prev track_number uri \\\n",
|
1010 |
+
"0 track_14 1.0 spotify:track:5qljLQuKnNJf4F4vfxQB0V \n",
|
1011 |
+
"1 track_3 3.0 spotify:track:3VAX2MJdmdqARLSU5hPMpm \n",
|
1012 |
+
"2 track_4 4.0 spotify:track:1L3YAhsEMrGVvCgDXj2TYn \n",
|
1013 |
+
"3 track_9 1.0 spotify:track:6aCe9zzoZmCojX7bbgKKtf \n",
|
1014 |
+
"4 track_2 2.0 spotify:track:1Vo802A38tPFHmje1h91um \n",
|
1015 |
+
"\n",
|
1016 |
+
" valence type \n",
|
1017 |
+
"0 0.6220 track \n",
|
1018 |
+
"1 0.5890 track \n",
|
1019 |
+
"2 0.0850 track \n",
|
1020 |
+
"3 0.5330 track \n",
|
1021 |
+
"4 0.0906 track \n",
|
1022 |
+
"\n",
|
1023 |
+
"[5 rows x 32 columns]"
|
1024 |
+
],
|
1025 |
+
"text/html": [
|
1026 |
+
"\n",
|
1027 |
+
" <div id=\"df-a317d767-9a8b-4a07-8bc0-8d0028475f92\">\n",
|
1028 |
+
" <div class=\"colab-df-container\">\n",
|
1029 |
+
" <div>\n",
|
1030 |
+
"<style scoped>\n",
|
1031 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1032 |
+
" vertical-align: middle;\n",
|
1033 |
+
" }\n",
|
1034 |
+
"\n",
|
1035 |
+
" .dataframe tbody tr th {\n",
|
1036 |
+
" vertical-align: top;\n",
|
1037 |
+
" }\n",
|
1038 |
+
"\n",
|
1039 |
+
" .dataframe thead th {\n",
|
1040 |
+
" text-align: right;\n",
|
1041 |
+
" }\n",
|
1042 |
+
"</style>\n",
|
1043 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1044 |
+
" <thead>\n",
|
1045 |
+
" <tr style=\"text-align: right;\">\n",
|
1046 |
+
" <th></th>\n",
|
1047 |
+
" <th>Unnamed: 0</th>\n",
|
1048 |
+
" <th>acousticness</th>\n",
|
1049 |
+
" <th>album_id</th>\n",
|
1050 |
+
" <th>analysis_url</th>\n",
|
1051 |
+
" <th>artists_id</th>\n",
|
1052 |
+
" <th>available_markets</th>\n",
|
1053 |
+
" <th>country</th>\n",
|
1054 |
+
" <th>danceability</th>\n",
|
1055 |
+
" <th>disc_number</th>\n",
|
1056 |
+
" <th>duration_ms</th>\n",
|
1057 |
+
" <th>...</th>\n",
|
1058 |
+
" <th>preview_url</th>\n",
|
1059 |
+
" <th>speechiness</th>\n",
|
1060 |
+
" <th>tempo</th>\n",
|
1061 |
+
" <th>time_signature</th>\n",
|
1062 |
+
" <th>track_href</th>\n",
|
1063 |
+
" <th>track_name_prev</th>\n",
|
1064 |
+
" <th>track_number</th>\n",
|
1065 |
+
" <th>uri</th>\n",
|
1066 |
+
" <th>valence</th>\n",
|
1067 |
+
" <th>type</th>\n",
|
1068 |
+
" </tr>\n",
|
1069 |
+
" </thead>\n",
|
1070 |
+
" <tbody>\n",
|
1071 |
+
" <tr>\n",
|
1072 |
+
" <th>0</th>\n",
|
1073 |
+
" <td>0</td>\n",
|
1074 |
+
" <td>0.294</td>\n",
|
1075 |
+
" <td>0D3QufeCudpQANOR7luqdr</td>\n",
|
1076 |
+
" <td>https://api.spotify.com/v1/audio-analysis/5qlj...</td>\n",
|
1077 |
+
" <td>['3mxJuHRn2ZWD5OofvJtDZY']</td>\n",
|
1078 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
1079 |
+
" <td>BE</td>\n",
|
1080 |
+
" <td>0.698</td>\n",
|
1081 |
+
" <td>1.0</td>\n",
|
1082 |
+
" <td>235584.0</td>\n",
|
1083 |
+
" <td>...</td>\n",
|
1084 |
+
" <td>https://p.scdn.co/mp3-preview/1b05a902da3a251d...</td>\n",
|
1085 |
+
" <td>0.0262</td>\n",
|
1086 |
+
" <td>115.018</td>\n",
|
1087 |
+
" <td>4.0</td>\n",
|
1088 |
+
" <td>https://api.spotify.com/v1/tracks/5qljLQuKnNJf...</td>\n",
|
1089 |
+
" <td>track_14</td>\n",
|
1090 |
+
" <td>1.0</td>\n",
|
1091 |
+
" <td>spotify:track:5qljLQuKnNJf4F4vfxQB0V</td>\n",
|
1092 |
+
" <td>0.6220</td>\n",
|
1093 |
+
" <td>track</td>\n",
|
1094 |
+
" </tr>\n",
|
1095 |
+
" <tr>\n",
|
1096 |
+
" <th>1</th>\n",
|
1097 |
+
" <td>1</td>\n",
|
1098 |
+
" <td>0.863</td>\n",
|
1099 |
+
" <td>1bcqsH5UyTBzmh9YizdsBE</td>\n",
|
1100 |
+
" <td>https://api.spotify.com/v1/audio-analysis/3VAX...</td>\n",
|
1101 |
+
" <td>['4xWMewm6CYMstu0sPgd9jJ']</td>\n",
|
1102 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
1103 |
+
" <td>BE</td>\n",
|
1104 |
+
" <td>0.719</td>\n",
|
1105 |
+
" <td>1.0</td>\n",
|
1106 |
+
" <td>656960.0</td>\n",
|
1107 |
+
" <td>...</td>\n",
|
1108 |
+
" <td>https://p.scdn.co/mp3-preview/d8140736a6131cb5...</td>\n",
|
1109 |
+
" <td>0.9220</td>\n",
|
1110 |
+
" <td>115.075</td>\n",
|
1111 |
+
" <td>3.0</td>\n",
|
1112 |
+
" <td>https://api.spotify.com/v1/tracks/3VAX2MJdmdqA...</td>\n",
|
1113 |
+
" <td>track_3</td>\n",
|
1114 |
+
" <td>3.0</td>\n",
|
1115 |
+
" <td>spotify:track:3VAX2MJdmdqARLSU5hPMpm</td>\n",
|
1116 |
+
" <td>0.5890</td>\n",
|
1117 |
+
" <td>track</td>\n",
|
1118 |
+
" </tr>\n",
|
1119 |
+
" <tr>\n",
|
1120 |
+
" <th>2</th>\n",
|
1121 |
+
" <td>2</td>\n",
|
1122 |
+
" <td>0.750</td>\n",
|
1123 |
+
" <td>4tKijjmxGClg4JOLAyo2qE</td>\n",
|
1124 |
+
" <td>https://api.spotify.com/v1/audio-analysis/1L3Y...</td>\n",
|
1125 |
+
" <td>['3hYaK5FF3YAglCj5HZgBnP']</td>\n",
|
1126 |
+
" <td>['GB']</td>\n",
|
1127 |
+
" <td>BE</td>\n",
|
1128 |
+
" <td>0.466</td>\n",
|
1129 |
+
" <td>1.0</td>\n",
|
1130 |
+
" <td>492840.0</td>\n",
|
1131 |
+
" <td>...</td>\n",
|
1132 |
+
" <td>https://p.scdn.co/mp3-preview/c8af28fb15185b18...</td>\n",
|
1133 |
+
" <td>0.9440</td>\n",
|
1134 |
+
" <td>79.565</td>\n",
|
1135 |
+
" <td>4.0</td>\n",
|
1136 |
+
" <td>https://api.spotify.com/v1/tracks/1L3YAhsEMrGV...</td>\n",
|
1137 |
+
" <td>track_4</td>\n",
|
1138 |
+
" <td>4.0</td>\n",
|
1139 |
+
" <td>spotify:track:1L3YAhsEMrGVvCgDXj2TYn</td>\n",
|
1140 |
+
" <td>0.0850</td>\n",
|
1141 |
+
" <td>track</td>\n",
|
1142 |
+
" </tr>\n",
|
1143 |
+
" <tr>\n",
|
1144 |
+
" <th>3</th>\n",
|
1145 |
+
" <td>3</td>\n",
|
1146 |
+
" <td>0.763</td>\n",
|
1147 |
+
" <td>6FeJF5r8roonnKraJxr4oB</td>\n",
|
1148 |
+
" <td>https://api.spotify.com/v1/audio-analysis/6aCe...</td>\n",
|
1149 |
+
" <td>['2KQsUB9DRBcJk17JWX1eXD']</td>\n",
|
1150 |
+
" <td>['AD', 'AE', 'AR', 'AT', 'AU', 'BE', 'BG', 'BH...</td>\n",
|
1151 |
+
" <td>BE</td>\n",
|
1152 |
+
" <td>0.719</td>\n",
|
1153 |
+
" <td>1.0</td>\n",
|
1154 |
+
" <td>316578.0</td>\n",
|
1155 |
+
" <td>...</td>\n",
|
1156 |
+
" <td>https://p.scdn.co/mp3-preview/7629b8e9f31f6e9b...</td>\n",
|
1157 |
+
" <td>0.9380</td>\n",
|
1158 |
+
" <td>112.822</td>\n",
|
1159 |
+
" <td>3.0</td>\n",
|
1160 |
+
" <td>https://api.spotify.com/v1/tracks/6aCe9zzoZmCo...</td>\n",
|
1161 |
+
" <td>track_9</td>\n",
|
1162 |
+
" <td>1.0</td>\n",
|
1163 |
+
" <td>spotify:track:6aCe9zzoZmCojX7bbgKKtf</td>\n",
|
1164 |
+
" <td>0.5330</td>\n",
|
1165 |
+
" <td>track</td>\n",
|
1166 |
+
" </tr>\n",
|
1167 |
+
" <tr>\n",
|
1168 |
+
" <th>4</th>\n",
|
1169 |
+
" <td>4</td>\n",
|
1170 |
+
" <td>0.770</td>\n",
|
1171 |
+
" <td>4tKijjmxGClg4JOLAyo2qE</td>\n",
|
1172 |
+
" <td>https://api.spotify.com/v1/audio-analysis/1Vo8...</td>\n",
|
1173 |
+
" <td>['3hYaK5FF3YAglCj5HZgBnP']</td>\n",
|
1174 |
+
" <td>['GB']</td>\n",
|
1175 |
+
" <td>BE</td>\n",
|
1176 |
+
" <td>0.460</td>\n",
|
1177 |
+
" <td>1.0</td>\n",
|
1178 |
+
" <td>558880.0</td>\n",
|
1179 |
+
" <td>...</td>\n",
|
1180 |
+
" <td>https://p.scdn.co/mp3-preview/32be593c0eb82868...</td>\n",
|
1181 |
+
" <td>0.9430</td>\n",
|
1182 |
+
" <td>81.260</td>\n",
|
1183 |
+
" <td>4.0</td>\n",
|
1184 |
+
" <td>https://api.spotify.com/v1/tracks/1Vo802A38tPF...</td>\n",
|
1185 |
+
" <td>track_2</td>\n",
|
1186 |
+
" <td>2.0</td>\n",
|
1187 |
+
" <td>spotify:track:1Vo802A38tPFHmje1h91um</td>\n",
|
1188 |
+
" <td>0.0906</td>\n",
|
1189 |
+
" <td>track</td>\n",
|
1190 |
+
" </tr>\n",
|
1191 |
+
" </tbody>\n",
|
1192 |
+
"</table>\n",
|
1193 |
+
"<p>5 rows × 32 columns</p>\n",
|
1194 |
+
"</div>\n",
|
1195 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a317d767-9a8b-4a07-8bc0-8d0028475f92')\"\n",
|
1196 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
1197 |
+
" style=\"display:none;\">\n",
|
1198 |
+
" \n",
|
1199 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
1200 |
+
" width=\"24px\">\n",
|
1201 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
1202 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
1203 |
+
" </svg>\n",
|
1204 |
+
" </button>\n",
|
1205 |
+
" \n",
|
1206 |
+
" <style>\n",
|
1207 |
+
" .colab-df-container {\n",
|
1208 |
+
" display:flex;\n",
|
1209 |
+
" flex-wrap:wrap;\n",
|
1210 |
+
" gap: 12px;\n",
|
1211 |
+
" }\n",
|
1212 |
+
"\n",
|
1213 |
+
" .colab-df-convert {\n",
|
1214 |
+
" background-color: #E8F0FE;\n",
|
1215 |
+
" border: none;\n",
|
1216 |
+
" border-radius: 50%;\n",
|
1217 |
+
" cursor: pointer;\n",
|
1218 |
+
" display: none;\n",
|
1219 |
+
" fill: #1967D2;\n",
|
1220 |
+
" height: 32px;\n",
|
1221 |
+
" padding: 0 0 0 0;\n",
|
1222 |
+
" width: 32px;\n",
|
1223 |
+
" }\n",
|
1224 |
+
"\n",
|
1225 |
+
" .colab-df-convert:hover {\n",
|
1226 |
+
" background-color: #E2EBFA;\n",
|
1227 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
1228 |
+
" fill: #174EA6;\n",
|
1229 |
+
" }\n",
|
1230 |
+
"\n",
|
1231 |
+
" [theme=dark] .colab-df-convert {\n",
|
1232 |
+
" background-color: #3B4455;\n",
|
1233 |
+
" fill: #D2E3FC;\n",
|
1234 |
+
" }\n",
|
1235 |
+
"\n",
|
1236 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
1237 |
+
" background-color: #434B5C;\n",
|
1238 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
1239 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
1240 |
+
" fill: #FFFFFF;\n",
|
1241 |
+
" }\n",
|
1242 |
+
" </style>\n",
|
1243 |
+
"\n",
|
1244 |
+
" <script>\n",
|
1245 |
+
" const buttonEl =\n",
|
1246 |
+
" document.querySelector('#df-a317d767-9a8b-4a07-8bc0-8d0028475f92 button.colab-df-convert');\n",
|
1247 |
+
" buttonEl.style.display =\n",
|
1248 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
1249 |
+
"\n",
|
1250 |
+
" async function convertToInteractive(key) {\n",
|
1251 |
+
" const element = document.querySelector('#df-a317d767-9a8b-4a07-8bc0-8d0028475f92');\n",
|
1252 |
+
" const dataTable =\n",
|
1253 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
1254 |
+
" [key], {});\n",
|
1255 |
+
" if (!dataTable) return;\n",
|
1256 |
+
"\n",
|
1257 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
1258 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
1259 |
+
" + ' to learn more about interactive tables.';\n",
|
1260 |
+
" element.innerHTML = '';\n",
|
1261 |
+
" dataTable['output_type'] = 'display_data';\n",
|
1262 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
1263 |
+
" const docLink = document.createElement('div');\n",
|
1264 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
1265 |
+
" element.appendChild(docLink);\n",
|
1266 |
+
" }\n",
|
1267 |
+
" </script>\n",
|
1268 |
+
" </div>\n",
|
1269 |
+
" </div>\n",
|
1270 |
+
" "
|
1271 |
+
]
|
1272 |
+
},
|
1273 |
+
"metadata": {}
|
1274 |
+
},
|
1275 |
+
{
|
1276 |
+
"output_type": "execute_result",
|
1277 |
+
"data": {
|
1278 |
+
"text/plain": [
|
1279 |
+
"Index(['Unnamed: 0', 'acousticness', 'album_id', 'analysis_url', 'artists_id',\n",
|
1280 |
+
" 'available_markets', 'country', 'danceability', 'disc_number',\n",
|
1281 |
+
" 'duration_ms', 'energy', 'href', 'id', 'instrumentalness', 'key',\n",
|
1282 |
+
" 'liveness', 'loudness', 'lyrics', 'mode', 'name', 'playlist',\n",
|
1283 |
+
" 'popularity', 'preview_url', 'speechiness', 'tempo', 'time_signature',\n",
|
1284 |
+
" 'track_href', 'track_name_prev', 'track_number', 'uri', 'valence',\n",
|
1285 |
+
" 'type'],\n",
|
1286 |
+
" dtype='object')"
|
1287 |
+
]
|
1288 |
+
},
|
1289 |
+
"metadata": {},
|
1290 |
+
"execution_count": 14
|
1291 |
+
}
|
1292 |
+
]
|
1293 |
+
},
|
1294 |
+
{
|
1295 |
+
"cell_type": "code",
|
1296 |
+
"source": [
|
1297 |
+
"## join artist genre information and album release date with track dataset\n",
|
1298 |
+
"# drop irrelevant columns\n",
|
1299 |
+
"# get only tracks after 1990\n",
|
1300 |
+
"def join_genre_and_date(artist_df, album_df, track_df):\n",
|
1301 |
+
" album = album_df.rename(columns={'id':\"album_id\"}).set_index('album_id')\n",
|
1302 |
+
" artist = artist_df.rename(columns={'id':\"artists_id\",'name':\"artists_name\"}).set_index('artists_id')\n",
|
1303 |
+
" track = track_df.set_index('album_id').join(album['release_date'], on='album_id' )\n",
|
1304 |
+
" track.artists_id = track.artists_id.apply(lambda x: x[2:-2])\n",
|
1305 |
+
" track = track.set_index('artists_id').join(artist[['artists_name','genres']], on='artists_id' )\n",
|
1306 |
+
" track.reset_index(drop=False, inplace=True)\n",
|
1307 |
+
" track['release_year'] = pd.to_datetime(track.release_date).dt.year\n",
|
1308 |
+
" track.drop(columns = ['Unnamed: 0','country','track_name_prev','track_number','type'], inplace = True)\n",
|
1309 |
+
" \n",
|
1310 |
+
" return track[track.release_year >= 1990]"
|
1311 |
+
],
|
1312 |
+
"metadata": {
|
1313 |
+
"id": "LZZhGSn46c_y"
|
1314 |
+
},
|
1315 |
+
"execution_count": 15,
|
1316 |
+
"outputs": []
|
1317 |
+
},
|
1318 |
+
{
|
1319 |
+
"cell_type": "code",
|
1320 |
+
"source": [
|
1321 |
+
"def get_filtered_track_df(df, genres_to_include):\n",
|
1322 |
+
" df['genres'] = df.genres.apply(lambda x: [i[1:-1] for i in str(x)[1:-1].split(\", \")])\n",
|
1323 |
+
" df_exploded = df.explode(\"genres\")[df.explode(\"genres\")[\"genres\"].isin(genres_to_include)]\n",
|
1324 |
+
" df_exploded.loc[df_exploded[\"genres\"]==\"korean pop\", \"genres\"] = \"k-pop\"\n",
|
1325 |
+
" df_exploded_indices = list(df_exploded.index.unique())\n",
|
1326 |
+
" df = df[df.index.isin(df_exploded_indices)]\n",
|
1327 |
+
" df = df.reset_index(drop=True)\n",
|
1328 |
+
" return df"
|
1329 |
+
],
|
1330 |
+
"metadata": {
|
1331 |
+
"id": "rP905-I66eB0"
|
1332 |
+
},
|
1333 |
+
"execution_count": 16,
|
1334 |
+
"outputs": []
|
1335 |
+
},
|
1336 |
+
{
|
1337 |
+
"cell_type": "code",
|
1338 |
+
"source": [
|
1339 |
+
"track_with_year_and_genre = join_genre_and_date(artists_data, albums_data, tracks_data)\n",
|
1340 |
+
"genres_to_include = genres = ['dance pop', 'electronic', 'electropop', 'hip hop', 'jazz', 'k-pop', 'latin', 'pop', 'pop rap', 'r&b', 'rock']\n",
|
1341 |
+
"filtered_track_df = get_filtered_track_df(track_with_year_and_genre, genres_to_include)"
|
1342 |
+
],
|
1343 |
+
"metadata": {
|
1344 |
+
"id": "7BmEttOn6iWy"
|
1345 |
+
},
|
1346 |
+
"execution_count": 18,
|
1347 |
+
"outputs": []
|
1348 |
+
},
|
1349 |
+
{
|
1350 |
+
"cell_type": "code",
|
1351 |
+
"source": [
|
1352 |
+
"filtered_track_df[\"uri\"] = filtered_track_df[\"uri\"].str.replace(\"spotify:track:\", \"\")\n",
|
1353 |
+
"filtered_track_df = filtered_track_df.drop(columns=['analysis_url', 'available_markets'])"
|
1354 |
+
],
|
1355 |
+
"metadata": {
|
1356 |
+
"id": "ghqON6di6n3e"
|
1357 |
+
},
|
1358 |
+
"execution_count": 19,
|
1359 |
+
"outputs": []
|
1360 |
+
},
|
1361 |
+
{
|
1362 |
+
"cell_type": "code",
|
1363 |
+
"source": [
|
1364 |
+
"display(filtered_track_df.head())\n",
|
1365 |
+
"filtered_track_df.columns"
|
1366 |
+
],
|
1367 |
+
"metadata": {
|
1368 |
+
"colab": {
|
1369 |
+
"base_uri": "https://localhost:8080/",
|
1370 |
+
"height": 751
|
1371 |
+
},
|
1372 |
+
"id": "a3Hwe1mB6qMU",
|
1373 |
+
"outputId": "0ed05171-2d9d-4b56-f3e3-b04e14485c79"
|
1374 |
+
},
|
1375 |
+
"execution_count": 20,
|
1376 |
+
"outputs": [
|
1377 |
+
{
|
1378 |
+
"output_type": "display_data",
|
1379 |
+
"data": {
|
1380 |
+
"text/plain": [
|
1381 |
+
" artists_id acousticness danceability disc_number \\\n",
|
1382 |
+
"0 68WwJXWrpo1yVOOIZjLSeT 0.0268 0.506 1.0 \n",
|
1383 |
+
"1 09xj0S68Y1OU1vHMCZAIvz 0.5050 0.487 1.0 \n",
|
1384 |
+
"2 6pSsE5y0uJMwYj83KrPyf9 0.1330 0.629 1.0 \n",
|
1385 |
+
"3 7slfeZO9LsJbWgpkIoXBUJ 0.4060 0.590 1.0 \n",
|
1386 |
+
"4 09hVIj6vWgoCDtT03h8ZCa 0.0316 0.727 1.0 \n",
|
1387 |
+
"\n",
|
1388 |
+
" duration_ms energy href \\\n",
|
1389 |
+
"0 248777.0 0.741 https://api.spotify.com/v1/tracks/0UATU9OJxh4m... \n",
|
1390 |
+
"1 171573.0 0.297 https://api.spotify.com/v1/tracks/4JH1M62gVDND... \n",
|
1391 |
+
"2 207396.0 0.706 https://api.spotify.com/v1/tracks/0h7Ld5CvgzaU... \n",
|
1392 |
+
"3 279000.0 0.597 https://api.spotify.com/v1/tracks/4S1bYWrLOC8s... \n",
|
1393 |
+
"4 218773.0 0.380 https://api.spotify.com/v1/tracks/758mQT4zzlvB... \n",
|
1394 |
+
"\n",
|
1395 |
+
" id instrumentalness key ... speechiness tempo \\\n",
|
1396 |
+
"0 0UATU9OJxh4m3fwDljdGZn 0.000027 1.0 ... 0.0349 94.042 \n",
|
1397 |
+
"1 4JH1M62gVDNDhDAUiQB3Qv 0.000052 11.0 ... 0.0915 185.912 \n",
|
1398 |
+
"2 0h7Ld5CvgzaUN1zA3tdyPq 0.000000 1.0 ... 0.4360 81.220 \n",
|
1399 |
+
"3 4S1bYWrLOC8smuy8kJzxKQ 0.000023 9.0 ... 0.0275 121.051 \n",
|
1400 |
+
"4 758mQT4zzlvBhy9PvNePwC 0.000000 7.0 ... 0.3350 92.050 \n",
|
1401 |
+
"\n",
|
1402 |
+
" time_signature track_href \\\n",
|
1403 |
+
"0 4.0 https://api.spotify.com/v1/tracks/0UATU9OJxh4m... \n",
|
1404 |
+
"1 3.0 https://api.spotify.com/v1/tracks/4JH1M62gVDND... \n",
|
1405 |
+
"2 4.0 https://api.spotify.com/v1/tracks/0h7Ld5CvgzaU... \n",
|
1406 |
+
"3 4.0 https://api.spotify.com/v1/tracks/4S1bYWrLOC8s... \n",
|
1407 |
+
"4 4.0 https://api.spotify.com/v1/tracks/758mQT4zzlvB... \n",
|
1408 |
+
"\n",
|
1409 |
+
" uri valence release_date artists_name \\\n",
|
1410 |
+
"0 0UATU9OJxh4m3fwDljdGZn 0.236 2018-09-28 Evalyn \n",
|
1411 |
+
"1 4JH1M62gVDNDhDAUiQB3Qv 0.289 2001-08-21 Café Tacvba \n",
|
1412 |
+
"2 0h7Ld5CvgzaUN1zA3tdyPq 0.543 2019-01-25 Dawn Richard \n",
|
1413 |
+
"3 4S1bYWrLOC8smuy8kJzxKQ 0.466 1995-09-12 Ricky Martin \n",
|
1414 |
+
"4 758mQT4zzlvBhy9PvNePwC 0.455 1991-09-24 A Tribe Called Quest \n",
|
1415 |
+
"\n",
|
1416 |
+
" genres release_year \n",
|
1417 |
+
"0 [electropop, indie electro-pop, indie poptimis... 2018 \n",
|
1418 |
+
"1 [latin, latin alternative, latin rock, mexican... 2001 \n",
|
1419 |
+
"2 [alternative r&b, deep pop r&b, escape room, h... 2019 \n",
|
1420 |
+
"3 [dance pop, latin, latin pop, mexican pop, pop... 1995 \n",
|
1421 |
+
"4 [alternative hip hop, conscious hip hop, east ... 1991 \n",
|
1422 |
+
"\n",
|
1423 |
+
"[5 rows x 28 columns]"
|
1424 |
+
],
|
1425 |
+
"text/html": [
|
1426 |
+
"\n",
|
1427 |
+
" <div id=\"df-2ac09e30-b225-407d-9e95-1016823bdae8\">\n",
|
1428 |
+
" <div class=\"colab-df-container\">\n",
|
1429 |
+
" <div>\n",
|
1430 |
+
"<style scoped>\n",
|
1431 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1432 |
+
" vertical-align: middle;\n",
|
1433 |
+
" }\n",
|
1434 |
+
"\n",
|
1435 |
+
" .dataframe tbody tr th {\n",
|
1436 |
+
" vertical-align: top;\n",
|
1437 |
+
" }\n",
|
1438 |
+
"\n",
|
1439 |
+
" .dataframe thead th {\n",
|
1440 |
+
" text-align: right;\n",
|
1441 |
+
" }\n",
|
1442 |
+
"</style>\n",
|
1443 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1444 |
+
" <thead>\n",
|
1445 |
+
" <tr style=\"text-align: right;\">\n",
|
1446 |
+
" <th></th>\n",
|
1447 |
+
" <th>artists_id</th>\n",
|
1448 |
+
" <th>acousticness</th>\n",
|
1449 |
+
" <th>danceability</th>\n",
|
1450 |
+
" <th>disc_number</th>\n",
|
1451 |
+
" <th>duration_ms</th>\n",
|
1452 |
+
" <th>energy</th>\n",
|
1453 |
+
" <th>href</th>\n",
|
1454 |
+
" <th>id</th>\n",
|
1455 |
+
" <th>instrumentalness</th>\n",
|
1456 |
+
" <th>key</th>\n",
|
1457 |
+
" <th>...</th>\n",
|
1458 |
+
" <th>speechiness</th>\n",
|
1459 |
+
" <th>tempo</th>\n",
|
1460 |
+
" <th>time_signature</th>\n",
|
1461 |
+
" <th>track_href</th>\n",
|
1462 |
+
" <th>uri</th>\n",
|
1463 |
+
" <th>valence</th>\n",
|
1464 |
+
" <th>release_date</th>\n",
|
1465 |
+
" <th>artists_name</th>\n",
|
1466 |
+
" <th>genres</th>\n",
|
1467 |
+
" <th>release_year</th>\n",
|
1468 |
+
" </tr>\n",
|
1469 |
+
" </thead>\n",
|
1470 |
+
" <tbody>\n",
|
1471 |
+
" <tr>\n",
|
1472 |
+
" <th>0</th>\n",
|
1473 |
+
" <td>68WwJXWrpo1yVOOIZjLSeT</td>\n",
|
1474 |
+
" <td>0.0268</td>\n",
|
1475 |
+
" <td>0.506</td>\n",
|
1476 |
+
" <td>1.0</td>\n",
|
1477 |
+
" <td>248777.0</td>\n",
|
1478 |
+
" <td>0.741</td>\n",
|
1479 |
+
" <td>https://api.spotify.com/v1/tracks/0UATU9OJxh4m...</td>\n",
|
1480 |
+
" <td>0UATU9OJxh4m3fwDljdGZn</td>\n",
|
1481 |
+
" <td>0.000027</td>\n",
|
1482 |
+
" <td>1.0</td>\n",
|
1483 |
+
" <td>...</td>\n",
|
1484 |
+
" <td>0.0349</td>\n",
|
1485 |
+
" <td>94.042</td>\n",
|
1486 |
+
" <td>4.0</td>\n",
|
1487 |
+
" <td>https://api.spotify.com/v1/tracks/0UATU9OJxh4m...</td>\n",
|
1488 |
+
" <td>0UATU9OJxh4m3fwDljdGZn</td>\n",
|
1489 |
+
" <td>0.236</td>\n",
|
1490 |
+
" <td>2018-09-28</td>\n",
|
1491 |
+
" <td>Evalyn</td>\n",
|
1492 |
+
" <td>[electropop, indie electro-pop, indie poptimis...</td>\n",
|
1493 |
+
" <td>2018</td>\n",
|
1494 |
+
" </tr>\n",
|
1495 |
+
" <tr>\n",
|
1496 |
+
" <th>1</th>\n",
|
1497 |
+
" <td>09xj0S68Y1OU1vHMCZAIvz</td>\n",
|
1498 |
+
" <td>0.5050</td>\n",
|
1499 |
+
" <td>0.487</td>\n",
|
1500 |
+
" <td>1.0</td>\n",
|
1501 |
+
" <td>171573.0</td>\n",
|
1502 |
+
" <td>0.297</td>\n",
|
1503 |
+
" <td>https://api.spotify.com/v1/tracks/4JH1M62gVDND...</td>\n",
|
1504 |
+
" <td>4JH1M62gVDNDhDAUiQB3Qv</td>\n",
|
1505 |
+
" <td>0.000052</td>\n",
|
1506 |
+
" <td>11.0</td>\n",
|
1507 |
+
" <td>...</td>\n",
|
1508 |
+
" <td>0.0915</td>\n",
|
1509 |
+
" <td>185.912</td>\n",
|
1510 |
+
" <td>3.0</td>\n",
|
1511 |
+
" <td>https://api.spotify.com/v1/tracks/4JH1M62gVDND...</td>\n",
|
1512 |
+
" <td>4JH1M62gVDNDhDAUiQB3Qv</td>\n",
|
1513 |
+
" <td>0.289</td>\n",
|
1514 |
+
" <td>2001-08-21</td>\n",
|
1515 |
+
" <td>Café Tacvba</td>\n",
|
1516 |
+
" <td>[latin, latin alternative, latin rock, mexican...</td>\n",
|
1517 |
+
" <td>2001</td>\n",
|
1518 |
+
" </tr>\n",
|
1519 |
+
" <tr>\n",
|
1520 |
+
" <th>2</th>\n",
|
1521 |
+
" <td>6pSsE5y0uJMwYj83KrPyf9</td>\n",
|
1522 |
+
" <td>0.1330</td>\n",
|
1523 |
+
" <td>0.629</td>\n",
|
1524 |
+
" <td>1.0</td>\n",
|
1525 |
+
" <td>207396.0</td>\n",
|
1526 |
+
" <td>0.706</td>\n",
|
1527 |
+
" <td>https://api.spotify.com/v1/tracks/0h7Ld5CvgzaU...</td>\n",
|
1528 |
+
" <td>0h7Ld5CvgzaUN1zA3tdyPq</td>\n",
|
1529 |
+
" <td>0.000000</td>\n",
|
1530 |
+
" <td>1.0</td>\n",
|
1531 |
+
" <td>...</td>\n",
|
1532 |
+
" <td>0.4360</td>\n",
|
1533 |
+
" <td>81.220</td>\n",
|
1534 |
+
" <td>4.0</td>\n",
|
1535 |
+
" <td>https://api.spotify.com/v1/tracks/0h7Ld5CvgzaU...</td>\n",
|
1536 |
+
" <td>0h7Ld5CvgzaUN1zA3tdyPq</td>\n",
|
1537 |
+
" <td>0.543</td>\n",
|
1538 |
+
" <td>2019-01-25</td>\n",
|
1539 |
+
" <td>Dawn Richard</td>\n",
|
1540 |
+
" <td>[alternative r&b, deep pop r&b, escape room, h...</td>\n",
|
1541 |
+
" <td>2019</td>\n",
|
1542 |
+
" </tr>\n",
|
1543 |
+
" <tr>\n",
|
1544 |
+
" <th>3</th>\n",
|
1545 |
+
" <td>7slfeZO9LsJbWgpkIoXBUJ</td>\n",
|
1546 |
+
" <td>0.4060</td>\n",
|
1547 |
+
" <td>0.590</td>\n",
|
1548 |
+
" <td>1.0</td>\n",
|
1549 |
+
" <td>279000.0</td>\n",
|
1550 |
+
" <td>0.597</td>\n",
|
1551 |
+
" <td>https://api.spotify.com/v1/tracks/4S1bYWrLOC8s...</td>\n",
|
1552 |
+
" <td>4S1bYWrLOC8smuy8kJzxKQ</td>\n",
|
1553 |
+
" <td>0.000023</td>\n",
|
1554 |
+
" <td>9.0</td>\n",
|
1555 |
+
" <td>...</td>\n",
|
1556 |
+
" <td>0.0275</td>\n",
|
1557 |
+
" <td>121.051</td>\n",
|
1558 |
+
" <td>4.0</td>\n",
|
1559 |
+
" <td>https://api.spotify.com/v1/tracks/4S1bYWrLOC8s...</td>\n",
|
1560 |
+
" <td>4S1bYWrLOC8smuy8kJzxKQ</td>\n",
|
1561 |
+
" <td>0.466</td>\n",
|
1562 |
+
" <td>1995-09-12</td>\n",
|
1563 |
+
" <td>Ricky Martin</td>\n",
|
1564 |
+
" <td>[dance pop, latin, latin pop, mexican pop, pop...</td>\n",
|
1565 |
+
" <td>1995</td>\n",
|
1566 |
+
" </tr>\n",
|
1567 |
+
" <tr>\n",
|
1568 |
+
" <th>4</th>\n",
|
1569 |
+
" <td>09hVIj6vWgoCDtT03h8ZCa</td>\n",
|
1570 |
+
" <td>0.0316</td>\n",
|
1571 |
+
" <td>0.727</td>\n",
|
1572 |
+
" <td>1.0</td>\n",
|
1573 |
+
" <td>218773.0</td>\n",
|
1574 |
+
" <td>0.380</td>\n",
|
1575 |
+
" <td>https://api.spotify.com/v1/tracks/758mQT4zzlvB...</td>\n",
|
1576 |
+
" <td>758mQT4zzlvBhy9PvNePwC</td>\n",
|
1577 |
+
" <td>0.000000</td>\n",
|
1578 |
+
" <td>7.0</td>\n",
|
1579 |
+
" <td>...</td>\n",
|
1580 |
+
" <td>0.3350</td>\n",
|
1581 |
+
" <td>92.050</td>\n",
|
1582 |
+
" <td>4.0</td>\n",
|
1583 |
+
" <td>https://api.spotify.com/v1/tracks/758mQT4zzlvB...</td>\n",
|
1584 |
+
" <td>758mQT4zzlvBhy9PvNePwC</td>\n",
|
1585 |
+
" <td>0.455</td>\n",
|
1586 |
+
" <td>1991-09-24</td>\n",
|
1587 |
+
" <td>A Tribe Called Quest</td>\n",
|
1588 |
+
" <td>[alternative hip hop, conscious hip hop, east ...</td>\n",
|
1589 |
+
" <td>1991</td>\n",
|
1590 |
+
" </tr>\n",
|
1591 |
+
" </tbody>\n",
|
1592 |
+
"</table>\n",
|
1593 |
+
"<p>5 rows × 28 columns</p>\n",
|
1594 |
+
"</div>\n",
|
1595 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-2ac09e30-b225-407d-9e95-1016823bdae8')\"\n",
|
1596 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
1597 |
+
" style=\"display:none;\">\n",
|
1598 |
+
" \n",
|
1599 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
1600 |
+
" width=\"24px\">\n",
|
1601 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
1602 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
1603 |
+
" </svg>\n",
|
1604 |
+
" </button>\n",
|
1605 |
+
" \n",
|
1606 |
+
" <style>\n",
|
1607 |
+
" .colab-df-container {\n",
|
1608 |
+
" display:flex;\n",
|
1609 |
+
" flex-wrap:wrap;\n",
|
1610 |
+
" gap: 12px;\n",
|
1611 |
+
" }\n",
|
1612 |
+
"\n",
|
1613 |
+
" .colab-df-convert {\n",
|
1614 |
+
" background-color: #E8F0FE;\n",
|
1615 |
+
" border: none;\n",
|
1616 |
+
" border-radius: 50%;\n",
|
1617 |
+
" cursor: pointer;\n",
|
1618 |
+
" display: none;\n",
|
1619 |
+
" fill: #1967D2;\n",
|
1620 |
+
" height: 32px;\n",
|
1621 |
+
" padding: 0 0 0 0;\n",
|
1622 |
+
" width: 32px;\n",
|
1623 |
+
" }\n",
|
1624 |
+
"\n",
|
1625 |
+
" .colab-df-convert:hover {\n",
|
1626 |
+
" background-color: #E2EBFA;\n",
|
1627 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
1628 |
+
" fill: #174EA6;\n",
|
1629 |
+
" }\n",
|
1630 |
+
"\n",
|
1631 |
+
" [theme=dark] .colab-df-convert {\n",
|
1632 |
+
" background-color: #3B4455;\n",
|
1633 |
+
" fill: #D2E3FC;\n",
|
1634 |
+
" }\n",
|
1635 |
+
"\n",
|
1636 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
1637 |
+
" background-color: #434B5C;\n",
|
1638 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
1639 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
1640 |
+
" fill: #FFFFFF;\n",
|
1641 |
+
" }\n",
|
1642 |
+
" </style>\n",
|
1643 |
+
"\n",
|
1644 |
+
" <script>\n",
|
1645 |
+
" const buttonEl =\n",
|
1646 |
+
" document.querySelector('#df-2ac09e30-b225-407d-9e95-1016823bdae8 button.colab-df-convert');\n",
|
1647 |
+
" buttonEl.style.display =\n",
|
1648 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
1649 |
+
"\n",
|
1650 |
+
" async function convertToInteractive(key) {\n",
|
1651 |
+
" const element = document.querySelector('#df-2ac09e30-b225-407d-9e95-1016823bdae8');\n",
|
1652 |
+
" const dataTable =\n",
|
1653 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
1654 |
+
" [key], {});\n",
|
1655 |
+
" if (!dataTable) return;\n",
|
1656 |
+
"\n",
|
1657 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
1658 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
1659 |
+
" + ' to learn more about interactive tables.';\n",
|
1660 |
+
" element.innerHTML = '';\n",
|
1661 |
+
" dataTable['output_type'] = 'display_data';\n",
|
1662 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
1663 |
+
" const docLink = document.createElement('div');\n",
|
1664 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
1665 |
+
" element.appendChild(docLink);\n",
|
1666 |
+
" }\n",
|
1667 |
+
" </script>\n",
|
1668 |
+
" </div>\n",
|
1669 |
+
" </div>\n",
|
1670 |
+
" "
|
1671 |
+
]
|
1672 |
+
},
|
1673 |
+
"metadata": {}
|
1674 |
+
},
|
1675 |
+
{
|
1676 |
+
"output_type": "execute_result",
|
1677 |
+
"data": {
|
1678 |
+
"text/plain": [
|
1679 |
+
"Index(['artists_id', 'acousticness', 'danceability', 'disc_number',\n",
|
1680 |
+
" 'duration_ms', 'energy', 'href', 'id', 'instrumentalness', 'key',\n",
|
1681 |
+
" 'liveness', 'loudness', 'lyrics', 'mode', 'name', 'playlist',\n",
|
1682 |
+
" 'popularity', 'preview_url', 'speechiness', 'tempo', 'time_signature',\n",
|
1683 |
+
" 'track_href', 'uri', 'valence', 'release_date', 'artists_name',\n",
|
1684 |
+
" 'genres', 'release_year'],\n",
|
1685 |
+
" dtype='object')"
|
1686 |
+
]
|
1687 |
+
},
|
1688 |
+
"metadata": {},
|
1689 |
+
"execution_count": 20
|
1690 |
+
}
|
1691 |
+
]
|
1692 |
+
},
|
1693 |
+
{
|
1694 |
+
"cell_type": "code",
|
1695 |
+
"source": [
|
1696 |
+
"filtered_track_df.to_csv(\"filtered_track_df.csv\", index=False)"
|
1697 |
+
],
|
1698 |
+
"metadata": {
|
1699 |
+
"id": "O9jsAS2D6rqY"
|
1700 |
+
},
|
1701 |
+
"execution_count": 21,
|
1702 |
+
"outputs": []
|
1703 |
+
},
|
1704 |
+
{
|
1705 |
+
"cell_type": "code",
|
1706 |
+
"source": [
|
1707 |
+
"tracks_data.describe()"
|
1708 |
+
],
|
1709 |
+
"metadata": {
|
1710 |
+
"colab": {
|
1711 |
+
"base_uri": "https://localhost:8080/",
|
1712 |
+
"height": 364
|
1713 |
+
},
|
1714 |
+
"id": "T7MIXjFh6urm",
|
1715 |
+
"outputId": "9ae43e81-94a4-4cfc-8be2-3c2e30ea0c62"
|
1716 |
+
},
|
1717 |
+
"execution_count": 22,
|
1718 |
+
"outputs": [
|
1719 |
+
{
|
1720 |
+
"output_type": "execute_result",
|
1721 |
+
"data": {
|
1722 |
+
"text/plain": [
|
1723 |
+
" Unnamed: 0 acousticness danceability disc_number \\\n",
|
1724 |
+
"count 101939.000000 101939.000000 101939.000000 101939.000000 \n",
|
1725 |
+
"mean 50969.000000 0.352124 0.586015 1.032166 \n",
|
1726 |
+
"std 29427.398883 0.334855 0.177724 0.566789 \n",
|
1727 |
+
"min 0.000000 0.000000 0.000000 1.000000 \n",
|
1728 |
+
"25% 25484.500000 0.040700 0.480000 1.000000 \n",
|
1729 |
+
"50% 50969.000000 0.238000 0.610000 1.000000 \n",
|
1730 |
+
"75% 76453.500000 0.645000 0.714000 1.000000 \n",
|
1731 |
+
"max 101938.000000 0.996000 0.989000 81.000000 \n",
|
1732 |
+
"\n",
|
1733 |
+
" duration_ms energy instrumentalness key \\\n",
|
1734 |
+
"count 1.019390e+05 101939.000000 101939.000000 101939.000000 \n",
|
1735 |
+
"mean 2.467708e+05 0.586479 0.148776 5.270858 \n",
|
1736 |
+
"std 1.904303e+05 0.260170 0.304024 3.577679 \n",
|
1737 |
+
"min 1.155000e+03 0.000000 0.000000 0.000000 \n",
|
1738 |
+
"25% 1.840000e+05 0.411000 0.000000 2.000000 \n",
|
1739 |
+
"50% 2.168930e+05 0.629000 0.000037 5.000000 \n",
|
1740 |
+
"75% 2.610550e+05 0.798000 0.034400 8.000000 \n",
|
1741 |
+
"max 5.505831e+06 1.000000 1.000000 11.000000 \n",
|
1742 |
+
"\n",
|
1743 |
+
" liveness loudness mode popularity \\\n",
|
1744 |
+
"count 101939.000000 101939.000000 101939.000000 101939.000000 \n",
|
1745 |
+
"mean 0.197640 -9.462720 0.618154 39.782311 \n",
|
1746 |
+
"std 0.175391 6.198508 0.485841 16.790769 \n",
|
1747 |
+
"min 0.000000 -60.000000 0.000000 0.000000 \n",
|
1748 |
+
"25% 0.095600 -11.149000 0.000000 29.000000 \n",
|
1749 |
+
"50% 0.124000 -7.599000 1.000000 41.000000 \n",
|
1750 |
+
"75% 0.241000 -5.509000 1.000000 52.000000 \n",
|
1751 |
+
"max 0.999000 2.719000 1.000000 97.000000 \n",
|
1752 |
+
"\n",
|
1753 |
+
" speechiness tempo time_signature track_number \\\n",
|
1754 |
+
"count 101939.000000 101939.000000 101939.000000 101939.000000 \n",
|
1755 |
+
"mean 0.128841 118.358527 3.875651 4.608060 \n",
|
1756 |
+
"std 0.203324 30.224074 0.517008 7.181805 \n",
|
1757 |
+
"min 0.000000 0.000000 0.000000 1.000000 \n",
|
1758 |
+
"25% 0.036400 95.973000 4.000000 1.000000 \n",
|
1759 |
+
"50% 0.050600 118.067000 4.000000 2.000000 \n",
|
1760 |
+
"75% 0.104000 136.045000 4.000000 6.000000 \n",
|
1761 |
+
"max 0.969000 244.035000 5.000000 655.000000 \n",
|
1762 |
+
"\n",
|
1763 |
+
" valence \n",
|
1764 |
+
"count 101939.000000 \n",
|
1765 |
+
"mean 0.482813 \n",
|
1766 |
+
"std 0.261690 \n",
|
1767 |
+
"min 0.000000 \n",
|
1768 |
+
"25% 0.271000 \n",
|
1769 |
+
"50% 0.477000 \n",
|
1770 |
+
"75% 0.693000 \n",
|
1771 |
+
"max 0.993000 "
|
1772 |
+
],
|
1773 |
+
"text/html": [
|
1774 |
+
"\n",
|
1775 |
+
" <div id=\"df-a3275db4-0443-4f89-89b9-8ec83d22feda\">\n",
|
1776 |
+
" <div class=\"colab-df-container\">\n",
|
1777 |
+
" <div>\n",
|
1778 |
+
"<style scoped>\n",
|
1779 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1780 |
+
" vertical-align: middle;\n",
|
1781 |
+
" }\n",
|
1782 |
+
"\n",
|
1783 |
+
" .dataframe tbody tr th {\n",
|
1784 |
+
" vertical-align: top;\n",
|
1785 |
+
" }\n",
|
1786 |
+
"\n",
|
1787 |
+
" .dataframe thead th {\n",
|
1788 |
+
" text-align: right;\n",
|
1789 |
+
" }\n",
|
1790 |
+
"</style>\n",
|
1791 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1792 |
+
" <thead>\n",
|
1793 |
+
" <tr style=\"text-align: right;\">\n",
|
1794 |
+
" <th></th>\n",
|
1795 |
+
" <th>Unnamed: 0</th>\n",
|
1796 |
+
" <th>acousticness</th>\n",
|
1797 |
+
" <th>danceability</th>\n",
|
1798 |
+
" <th>disc_number</th>\n",
|
1799 |
+
" <th>duration_ms</th>\n",
|
1800 |
+
" <th>energy</th>\n",
|
1801 |
+
" <th>instrumentalness</th>\n",
|
1802 |
+
" <th>key</th>\n",
|
1803 |
+
" <th>liveness</th>\n",
|
1804 |
+
" <th>loudness</th>\n",
|
1805 |
+
" <th>mode</th>\n",
|
1806 |
+
" <th>popularity</th>\n",
|
1807 |
+
" <th>speechiness</th>\n",
|
1808 |
+
" <th>tempo</th>\n",
|
1809 |
+
" <th>time_signature</th>\n",
|
1810 |
+
" <th>track_number</th>\n",
|
1811 |
+
" <th>valence</th>\n",
|
1812 |
+
" </tr>\n",
|
1813 |
+
" </thead>\n",
|
1814 |
+
" <tbody>\n",
|
1815 |
+
" <tr>\n",
|
1816 |
+
" <th>count</th>\n",
|
1817 |
+
" <td>101939.000000</td>\n",
|
1818 |
+
" <td>101939.000000</td>\n",
|
1819 |
+
" <td>101939.000000</td>\n",
|
1820 |
+
" <td>101939.000000</td>\n",
|
1821 |
+
" <td>1.019390e+05</td>\n",
|
1822 |
+
" <td>101939.000000</td>\n",
|
1823 |
+
" <td>101939.000000</td>\n",
|
1824 |
+
" <td>101939.000000</td>\n",
|
1825 |
+
" <td>101939.000000</td>\n",
|
1826 |
+
" <td>101939.000000</td>\n",
|
1827 |
+
" <td>101939.000000</td>\n",
|
1828 |
+
" <td>101939.000000</td>\n",
|
1829 |
+
" <td>101939.000000</td>\n",
|
1830 |
+
" <td>101939.000000</td>\n",
|
1831 |
+
" <td>101939.000000</td>\n",
|
1832 |
+
" <td>101939.000000</td>\n",
|
1833 |
+
" <td>101939.000000</td>\n",
|
1834 |
+
" </tr>\n",
|
1835 |
+
" <tr>\n",
|
1836 |
+
" <th>mean</th>\n",
|
1837 |
+
" <td>50969.000000</td>\n",
|
1838 |
+
" <td>0.352124</td>\n",
|
1839 |
+
" <td>0.586015</td>\n",
|
1840 |
+
" <td>1.032166</td>\n",
|
1841 |
+
" <td>2.467708e+05</td>\n",
|
1842 |
+
" <td>0.586479</td>\n",
|
1843 |
+
" <td>0.148776</td>\n",
|
1844 |
+
" <td>5.270858</td>\n",
|
1845 |
+
" <td>0.197640</td>\n",
|
1846 |
+
" <td>-9.462720</td>\n",
|
1847 |
+
" <td>0.618154</td>\n",
|
1848 |
+
" <td>39.782311</td>\n",
|
1849 |
+
" <td>0.128841</td>\n",
|
1850 |
+
" <td>118.358527</td>\n",
|
1851 |
+
" <td>3.875651</td>\n",
|
1852 |
+
" <td>4.608060</td>\n",
|
1853 |
+
" <td>0.482813</td>\n",
|
1854 |
+
" </tr>\n",
|
1855 |
+
" <tr>\n",
|
1856 |
+
" <th>std</th>\n",
|
1857 |
+
" <td>29427.398883</td>\n",
|
1858 |
+
" <td>0.334855</td>\n",
|
1859 |
+
" <td>0.177724</td>\n",
|
1860 |
+
" <td>0.566789</td>\n",
|
1861 |
+
" <td>1.904303e+05</td>\n",
|
1862 |
+
" <td>0.260170</td>\n",
|
1863 |
+
" <td>0.304024</td>\n",
|
1864 |
+
" <td>3.577679</td>\n",
|
1865 |
+
" <td>0.175391</td>\n",
|
1866 |
+
" <td>6.198508</td>\n",
|
1867 |
+
" <td>0.485841</td>\n",
|
1868 |
+
" <td>16.790769</td>\n",
|
1869 |
+
" <td>0.203324</td>\n",
|
1870 |
+
" <td>30.224074</td>\n",
|
1871 |
+
" <td>0.517008</td>\n",
|
1872 |
+
" <td>7.181805</td>\n",
|
1873 |
+
" <td>0.261690</td>\n",
|
1874 |
+
" </tr>\n",
|
1875 |
+
" <tr>\n",
|
1876 |
+
" <th>min</th>\n",
|
1877 |
+
" <td>0.000000</td>\n",
|
1878 |
+
" <td>0.000000</td>\n",
|
1879 |
+
" <td>0.000000</td>\n",
|
1880 |
+
" <td>1.000000</td>\n",
|
1881 |
+
" <td>1.155000e+03</td>\n",
|
1882 |
+
" <td>0.000000</td>\n",
|
1883 |
+
" <td>0.000000</td>\n",
|
1884 |
+
" <td>0.000000</td>\n",
|
1885 |
+
" <td>0.000000</td>\n",
|
1886 |
+
" <td>-60.000000</td>\n",
|
1887 |
+
" <td>0.000000</td>\n",
|
1888 |
+
" <td>0.000000</td>\n",
|
1889 |
+
" <td>0.000000</td>\n",
|
1890 |
+
" <td>0.000000</td>\n",
|
1891 |
+
" <td>0.000000</td>\n",
|
1892 |
+
" <td>1.000000</td>\n",
|
1893 |
+
" <td>0.000000</td>\n",
|
1894 |
+
" </tr>\n",
|
1895 |
+
" <tr>\n",
|
1896 |
+
" <th>25%</th>\n",
|
1897 |
+
" <td>25484.500000</td>\n",
|
1898 |
+
" <td>0.040700</td>\n",
|
1899 |
+
" <td>0.480000</td>\n",
|
1900 |
+
" <td>1.000000</td>\n",
|
1901 |
+
" <td>1.840000e+05</td>\n",
|
1902 |
+
" <td>0.411000</td>\n",
|
1903 |
+
" <td>0.000000</td>\n",
|
1904 |
+
" <td>2.000000</td>\n",
|
1905 |
+
" <td>0.095600</td>\n",
|
1906 |
+
" <td>-11.149000</td>\n",
|
1907 |
+
" <td>0.000000</td>\n",
|
1908 |
+
" <td>29.000000</td>\n",
|
1909 |
+
" <td>0.036400</td>\n",
|
1910 |
+
" <td>95.973000</td>\n",
|
1911 |
+
" <td>4.000000</td>\n",
|
1912 |
+
" <td>1.000000</td>\n",
|
1913 |
+
" <td>0.271000</td>\n",
|
1914 |
+
" </tr>\n",
|
1915 |
+
" <tr>\n",
|
1916 |
+
" <th>50%</th>\n",
|
1917 |
+
" <td>50969.000000</td>\n",
|
1918 |
+
" <td>0.238000</td>\n",
|
1919 |
+
" <td>0.610000</td>\n",
|
1920 |
+
" <td>1.000000</td>\n",
|
1921 |
+
" <td>2.168930e+05</td>\n",
|
1922 |
+
" <td>0.629000</td>\n",
|
1923 |
+
" <td>0.000037</td>\n",
|
1924 |
+
" <td>5.000000</td>\n",
|
1925 |
+
" <td>0.124000</td>\n",
|
1926 |
+
" <td>-7.599000</td>\n",
|
1927 |
+
" <td>1.000000</td>\n",
|
1928 |
+
" <td>41.000000</td>\n",
|
1929 |
+
" <td>0.050600</td>\n",
|
1930 |
+
" <td>118.067000</td>\n",
|
1931 |
+
" <td>4.000000</td>\n",
|
1932 |
+
" <td>2.000000</td>\n",
|
1933 |
+
" <td>0.477000</td>\n",
|
1934 |
+
" </tr>\n",
|
1935 |
+
" <tr>\n",
|
1936 |
+
" <th>75%</th>\n",
|
1937 |
+
" <td>76453.500000</td>\n",
|
1938 |
+
" <td>0.645000</td>\n",
|
1939 |
+
" <td>0.714000</td>\n",
|
1940 |
+
" <td>1.000000</td>\n",
|
1941 |
+
" <td>2.610550e+05</td>\n",
|
1942 |
+
" <td>0.798000</td>\n",
|
1943 |
+
" <td>0.034400</td>\n",
|
1944 |
+
" <td>8.000000</td>\n",
|
1945 |
+
" <td>0.241000</td>\n",
|
1946 |
+
" <td>-5.509000</td>\n",
|
1947 |
+
" <td>1.000000</td>\n",
|
1948 |
+
" <td>52.000000</td>\n",
|
1949 |
+
" <td>0.104000</td>\n",
|
1950 |
+
" <td>136.045000</td>\n",
|
1951 |
+
" <td>4.000000</td>\n",
|
1952 |
+
" <td>6.000000</td>\n",
|
1953 |
+
" <td>0.693000</td>\n",
|
1954 |
+
" </tr>\n",
|
1955 |
+
" <tr>\n",
|
1956 |
+
" <th>max</th>\n",
|
1957 |
+
" <td>101938.000000</td>\n",
|
1958 |
+
" <td>0.996000</td>\n",
|
1959 |
+
" <td>0.989000</td>\n",
|
1960 |
+
" <td>81.000000</td>\n",
|
1961 |
+
" <td>5.505831e+06</td>\n",
|
1962 |
+
" <td>1.000000</td>\n",
|
1963 |
+
" <td>1.000000</td>\n",
|
1964 |
+
" <td>11.000000</td>\n",
|
1965 |
+
" <td>0.999000</td>\n",
|
1966 |
+
" <td>2.719000</td>\n",
|
1967 |
+
" <td>1.000000</td>\n",
|
1968 |
+
" <td>97.000000</td>\n",
|
1969 |
+
" <td>0.969000</td>\n",
|
1970 |
+
" <td>244.035000</td>\n",
|
1971 |
+
" <td>5.000000</td>\n",
|
1972 |
+
" <td>655.000000</td>\n",
|
1973 |
+
" <td>0.993000</td>\n",
|
1974 |
+
" </tr>\n",
|
1975 |
+
" </tbody>\n",
|
1976 |
+
"</table>\n",
|
1977 |
+
"</div>\n",
|
1978 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a3275db4-0443-4f89-89b9-8ec83d22feda')\"\n",
|
1979 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
1980 |
+
" style=\"display:none;\">\n",
|
1981 |
+
" \n",
|
1982 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
1983 |
+
" width=\"24px\">\n",
|
1984 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
1985 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
1986 |
+
" </svg>\n",
|
1987 |
+
" </button>\n",
|
1988 |
+
" \n",
|
1989 |
+
" <style>\n",
|
1990 |
+
" .colab-df-container {\n",
|
1991 |
+
" display:flex;\n",
|
1992 |
+
" flex-wrap:wrap;\n",
|
1993 |
+
" gap: 12px;\n",
|
1994 |
+
" }\n",
|
1995 |
+
"\n",
|
1996 |
+
" .colab-df-convert {\n",
|
1997 |
+
" background-color: #E8F0FE;\n",
|
1998 |
+
" border: none;\n",
|
1999 |
+
" border-radius: 50%;\n",
|
2000 |
+
" cursor: pointer;\n",
|
2001 |
+
" display: none;\n",
|
2002 |
+
" fill: #1967D2;\n",
|
2003 |
+
" height: 32px;\n",
|
2004 |
+
" padding: 0 0 0 0;\n",
|
2005 |
+
" width: 32px;\n",
|
2006 |
+
" }\n",
|
2007 |
+
"\n",
|
2008 |
+
" .colab-df-convert:hover {\n",
|
2009 |
+
" background-color: #E2EBFA;\n",
|
2010 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
2011 |
+
" fill: #174EA6;\n",
|
2012 |
+
" }\n",
|
2013 |
+
"\n",
|
2014 |
+
" [theme=dark] .colab-df-convert {\n",
|
2015 |
+
" background-color: #3B4455;\n",
|
2016 |
+
" fill: #D2E3FC;\n",
|
2017 |
+
" }\n",
|
2018 |
+
"\n",
|
2019 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
2020 |
+
" background-color: #434B5C;\n",
|
2021 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
2022 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
2023 |
+
" fill: #FFFFFF;\n",
|
2024 |
+
" }\n",
|
2025 |
+
" </style>\n",
|
2026 |
+
"\n",
|
2027 |
+
" <script>\n",
|
2028 |
+
" const buttonEl =\n",
|
2029 |
+
" document.querySelector('#df-a3275db4-0443-4f89-89b9-8ec83d22feda button.colab-df-convert');\n",
|
2030 |
+
" buttonEl.style.display =\n",
|
2031 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
2032 |
+
"\n",
|
2033 |
+
" async function convertToInteractive(key) {\n",
|
2034 |
+
" const element = document.querySelector('#df-a3275db4-0443-4f89-89b9-8ec83d22feda');\n",
|
2035 |
+
" const dataTable =\n",
|
2036 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
2037 |
+
" [key], {});\n",
|
2038 |
+
" if (!dataTable) return;\n",
|
2039 |
+
"\n",
|
2040 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
2041 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
2042 |
+
" + ' to learn more about interactive tables.';\n",
|
2043 |
+
" element.innerHTML = '';\n",
|
2044 |
+
" dataTable['output_type'] = 'display_data';\n",
|
2045 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
2046 |
+
" const docLink = document.createElement('div');\n",
|
2047 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
2048 |
+
" element.appendChild(docLink);\n",
|
2049 |
+
" }\n",
|
2050 |
+
" </script>\n",
|
2051 |
+
" </div>\n",
|
2052 |
+
" </div>\n",
|
2053 |
+
" "
|
2054 |
+
]
|
2055 |
+
},
|
2056 |
+
"metadata": {},
|
2057 |
+
"execution_count": 22
|
2058 |
+
}
|
2059 |
+
]
|
2060 |
+
}
|
2061 |
+
]
|
2062 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit==1.0.0
|
2 |
+
pandas==1.3.3
|
3 |
+
plotly==5.3.1
|
4 |
+
scikit-learn==0.23.2
|