質問編集履歴
6
コードの修繕
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,19 +12,45 @@
|
|
12
12
|
|
13
13
|
```
|
14
14
|
|
15
|
+
https://open.spotify.com/track/58dxGXavrcagRqA58fNB0Z <class 'str'>
|
16
|
+
|
17
|
+
https://open.spotify.com/track/2yozZfRYHP7Elsymghu5t3 <class 'str'>
|
18
|
+
|
19
|
+
https://open.spotify.com/track/3S3DDZrPOYTirleXRyHnNM <class 'str'>
|
20
|
+
|
21
|
+
https://open.spotify.com/track/5DMEvbg3gUmiR5HIBWdveV <class 'str'>
|
22
|
+
|
23
|
+
中略
|
24
|
+
|
25
|
+
https://open.spotify.com/track/0U9vBvoG3LN1PnuVl47E3W <class 'str'>
|
26
|
+
|
27
|
+
https://open.spotify.com/track/2tgWF9EZzqiq4Qzdzeow1A <class 'str'>
|
28
|
+
|
29
|
+
https://open.spotify.com/track/4jaaMznp3KPllxbmRdiIbx <class 'str'>
|
30
|
+
|
31
|
+
https://open.spotify.com/track/6Flllj0iIJPwXUpxL9KdxC <class 'str'>
|
32
|
+
|
33
|
+
https://open.spotify.com/track/4XkqVSWIPb07iLEDvAPq93 <class 'str'>
|
34
|
+
|
35
|
+
https://open.spotify.com/track/7yXwERf5YbjCXkVqU1fZvA <class 'str'>
|
36
|
+
|
37
|
+
nan <class 'float'>
|
38
|
+
|
39
|
+
---------------------------------------------------------------------------
|
40
|
+
|
15
41
|
TypeError Traceback (most recent call last)
|
16
42
|
|
17
|
-
<ipython-input-5
|
43
|
+
<ipython-input-24-69a5d88baf73> in <module>()
|
18
|
-
|
19
|
-
4
|
20
44
|
|
21
45
|
5 for url in songs["URL"] :
|
22
46
|
|
23
|
-
|
47
|
+
6 print(url, type(url))
|
24
48
|
|
25
|
-
|
49
|
+
----> 7 df = pd.DataFrame.from_dict(spotify.audio_features(url))
|
26
50
|
|
51
|
+
8 song_info = song_info.append(df)
|
52
|
+
|
27
|
-
|
53
|
+
9
|
28
54
|
|
29
55
|
|
30
56
|
|
@@ -39,6 +65,8 @@
|
|
39
65
|
829 results = self._get('audio-features/?ids=' + ','.join(tlist))
|
40
66
|
|
41
67
|
830 # the response has changed, look for the new style first, and if
|
68
|
+
|
69
|
+
|
42
70
|
|
43
71
|
TypeError: 'float' object is not iterable
|
44
72
|
|
@@ -82,15 +110,17 @@
|
|
82
110
|
|
83
111
|
|
84
112
|
|
85
|
-
URL = ["
|
113
|
+
URL = ["https://open.spotify.com/track/58dxGXavrcagRqA58fNB0Z"]
|
86
114
|
|
87
115
|
|
88
116
|
|
89
|
-
for url in songs["URL"] :
|
117
|
+
for url in songs["URL"] :
|
90
118
|
|
91
|
-
|
119
|
+
print(url, type(url))
|
92
120
|
|
121
|
+
df = pd.DataFrame.from_dict(spotify.audio_features(url))
|
122
|
+
|
93
|
-
|
123
|
+
song_info = song_info.append(df)
|
94
124
|
|
95
125
|
|
96
126
|
|
@@ -99,6 +129,8 @@
|
|
99
129
|
song_info=song_info.reset_index(drop=True)
|
100
130
|
|
101
131
|
song_info.head(10)
|
132
|
+
|
133
|
+
song_info.dtypes
|
102
134
|
|
103
135
|
dropna(how="all")
|
104
136
|
|
5
コードの修繕
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
|
84
84
|
|
85
|
-
URL = ["https://open.spotify.com/track/58dxGXavrcagRqA58fNB0Z"]
|
85
|
+
URL = ["[楽曲、PretenderのURL](https://open.spotify.com/track/58dxGXavrcagRqA58fNB0Z)"]
|
86
86
|
|
87
87
|
|
88
88
|
|
4
コードの修繕
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,11 +40,11 @@
|
|
40
40
|
|
41
41
|
830 # the response has changed, look for the new style first, and if
|
42
42
|
|
43
|
-
|
43
|
+
TypeError: 'float' object is not iterable
|
44
44
|
|
45
45
|
```
|
46
46
|
|
47
|
-
|
47
|
+
|
48
48
|
|
49
49
|
### 該当のソースコード
|
50
50
|
|
3
コードの修繕
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
分からないことがたくさんあり、教えていただけると幸いです
|
10
10
|
|
11
11
|
### 発生している問題・エラーメッセージ
|
12
|
+
|
13
|
+
```
|
12
14
|
|
13
15
|
TypeError Traceback (most recent call last)
|
14
16
|
|
@@ -40,9 +42,13 @@
|
|
40
42
|
|
41
43
|
|
42
44
|
|
45
|
+
```
|
46
|
+
|
43
47
|
TypeError: 'float' object is not iterable
|
44
48
|
|
45
49
|
### 該当のソースコード
|
50
|
+
|
51
|
+
```
|
46
52
|
|
47
53
|
!pip install pandas
|
48
54
|
|
@@ -58,9 +64,9 @@
|
|
58
64
|
|
59
65
|
import csv
|
60
66
|
|
61
|
-
client_id =
|
67
|
+
client_id =
|
62
68
|
|
63
|
-
client_secret =
|
69
|
+
client_secret =
|
64
70
|
|
65
71
|
client_credentials_manager = spotipy.oauth2.SpotifyClientCredentials(client_id, client_secret)
|
66
72
|
|
@@ -86,7 +92,9 @@
|
|
86
92
|
|
87
93
|
song_info = song_info.append(df)
|
88
94
|
|
95
|
+
|
96
|
+
|
89
|
-
|
97
|
+
#index振り直し
|
90
98
|
|
91
99
|
song_info=song_info.reset_index(drop=True)
|
92
100
|
|
@@ -94,7 +102,7 @@
|
|
94
102
|
|
95
103
|
dropna(how="all")
|
96
104
|
|
97
|
-
|
105
|
+
```
|
98
106
|
|
99
107
|
### 試したこと
|
100
108
|
|
2
コードの修繕
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,9 +10,67 @@
|
|
10
10
|
|
11
11
|
### 発生している問題・エラーメッセージ
|
12
12
|
|
13
|
+
TypeError Traceback (most recent call last)
|
14
|
+
|
15
|
+
<ipython-input-5-c14133083d45> in <module>()
|
16
|
+
|
17
|
+
4
|
18
|
+
|
19
|
+
5 for url in songs["URL"] :
|
20
|
+
|
21
|
+
----> 6 df = pd.DataFrame.from_dict(spotify.audio_features(url))
|
22
|
+
|
23
|
+
7 song_info = song_info.append(df)
|
24
|
+
|
25
|
+
8
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
/usr/local/lib/python3.6/dist-packages/spotipy/client.py in audio_features(self, tracks)
|
30
|
+
|
31
|
+
826 results = self._get('audio-features/?ids=' + trackid)
|
32
|
+
|
33
|
+
827 else:
|
34
|
+
|
35
|
+
--> 828 tlist = [self._get_id('track', t) for t in tracks]
|
36
|
+
|
37
|
+
829 results = self._get('audio-features/?ids=' + ','.join(tlist))
|
38
|
+
|
39
|
+
830 # the response has changed, look for the new style first, and if
|
40
|
+
|
41
|
+
|
42
|
+
|
13
43
|
TypeError: 'float' object is not iterable
|
14
44
|
|
15
45
|
### 該当のソースコード
|
46
|
+
|
47
|
+
!pip install pandas
|
48
|
+
|
49
|
+
!pip install spotipy
|
50
|
+
|
51
|
+
import pandas as pd
|
52
|
+
|
53
|
+
import spotipy
|
54
|
+
|
55
|
+
from spotipy.oauth2 import SpotifyClientCredentials
|
56
|
+
|
57
|
+
import json
|
58
|
+
|
59
|
+
import csv
|
60
|
+
|
61
|
+
client_id = ''
|
62
|
+
|
63
|
+
client_secret = ''
|
64
|
+
|
65
|
+
client_credentials_manager = spotipy.oauth2.SpotifyClientCredentials(client_id, client_secret)
|
66
|
+
|
67
|
+
spotify = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
68
|
+
|
69
|
+
songs = pd.read_csv("data.csv", encoding="shift-jis" , index_col=0)
|
70
|
+
|
71
|
+
songs.head(10)
|
72
|
+
|
73
|
+
|
16
74
|
|
17
75
|
song_info = pd.DataFrame()
|
18
76
|
|
@@ -46,6 +104,8 @@
|
|
46
104
|
|
47
105
|
### 補足情報(FW/ツールのバージョンなど)
|
48
106
|
|
107
|
+
GoolgleColabolatlyを使用させていただいています
|
49
108
|
|
109
|
+
https://qiita.com/kazuya-n/items/fbee07ef778e166cb6dd
|
50
110
|
|
51
|
-
|
111
|
+
参考にさせていただいているサイトのURLです
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,8 +36,6 @@
|
|
36
36
|
|
37
37
|
dropna(how="all")
|
38
38
|
|
39
|
-
```ここに言語名を入力
|
40
|
-
|
41
39
|
|
42
40
|
|
43
41
|
### 試したこと
|