-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_spotify_unwrapped.py
More file actions
32 lines (27 loc) · 1.17 KB
/
test_spotify_unwrapped.py
File metadata and controls
32 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from spotify_unwrapped import SpotifyUnwrapped
import pandas as pd
def main():
unwrapped = SpotifyUnwrapped()
json_files = ["MySpotifyData/StreamingHistory0.json"]
all_dfs = []
for json_file in json_files:
df = unwrapped.json_batch_update(json_file)
all_dfs.append(df)
yearly_data = pd.concat(all_dfs, axis=0)
unwrapped.finalise_dataframes(yearly_data)
year_top_artist_streams, year_top_artist_time = unwrapped.get_yearly_top_artists()
year_top_songs_streams, year_top_songs_time = unwrapped.get_yearly_top_songs()
year_top_podcs_streams, year_top_podcs_time = unwrapped.get_yearly_top_podcasts()
year_top_albums_streams, year_top_albums_cum_time = unwrapped.get_yearly_top_albums()
print(year_top_albums_streams)
print(year_top_albums_cum_time)
unwrapped.get_yearly_album_artwork(year_top_albums_streams)
#print(year_top_podcs_streams)
#print(year_top_podcs_time)
#yearly_data = unwrapped.add_genres_to_df(yearly_data)
#print(yearly_data.head(10))
#print(yearly_data.tail(10))
#yearly_data.to_csv("test.csv")
#unwrapped.get_yearly_top_genres(yearly_data)
if __name__ == "__main__":
main()