psy-3035-python-course
Data visualization using Python. Master's course (PSY-3035) at UiT.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.1%) to scientific vocabulary
Repository
Data visualization using Python. Master's course (PSY-3035) at UiT.
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Spotify Visualizing
Repository for exam in course "PSY-3035 - Programming and Data Visualization for Researchers" at UiT - The Arctic University of Norway (https://uit.no/utdanning/emner/emne/785298/psy-3035).
A repository with simple scripts to visualize Spotify data.
The script "Spotify_Visualizing" under "src" named can immediately be run to produce the figures under "fig".
Citing:
Aasen, S., R. (2023). Python Data Visualization, https://github.com/a-asen/Spotify_Visualizing
Toggles
The script is currently set up to run immediately and reproduce the figure under "fig". The script has 3 toggles: 1. "skipauthorization" will skip the Spotify authorization process (True) or not (False). 2. "spotifybasicauthorization" which is used to authorize either basic access (True) or user access (False). 3. "boxplotinclude_all" will add two extra features to the box plot (True) which has otherwise been left out (False).
Data
The script will checks if there is existing data in the "data" folder. This is to be able to use the same data that I use to visualize. If you want your own data you can delete/rename "mytoptracks2022.csv" and "mytoptracks2022features.csv". Alternatively you can change the saving/checking names in the script to get your own data. _* Note: Only "my" data has to be deleted/renamed/moved if you compare your own data against the world 2022.
The data stored under "data": - My top songs (100 tracks) - "mytoptracks2022.csv" - "mytoptracks2022features.csv", - World top songs (50 tracks) - "toptracksworld2022.csv" - "toptracksworldfeatures2022.csv" - "t-test_table.xlsx" is a saved table
Script
Running the main script "Spotify_Visualizing.py" under the "src" folder should recreate all figures under "fig". It will: 1. Read all the data necessary to create the plots 2. Create four plots - These plots are available under the "fig" folder.
Visualizing
We plot the track features of each playlist against each other.
First plot
For the first plot, we check the top 20 songs of each playlist and map the "danceability" per track on a line plot. The two datasets were split by colour and line type: green & whole (my data) and orange and dotted (world data)

Second plot
For the second plot, we look at the general differences across the playlist features of the top 50 tracks (max tracks for the World playlist).
Relevant transformations of the data are done before the visualizing part. Such as removing uninformative columns and combining the two data frames.

Third & fourth plot
For the third and fourth plot, we create a correlation matrix for each dataset. Each plot looks at the correlations between song features within each playlist.
| My Playlist | World Playlist |
|---|---|
|
|
|
Extra Functions:
A function script is found under "lib" and can be accessed with the "lib" shorthand. It contains both functions to get data to a data frame, and some extra functions if you want to further explore your own data/other data. - lastplayeddf - Input: sp - Get the last (50) played songs and add them to a data frame (pandas). - Require Spotify user authentication call (typically "sp") - Output: Pandas data frame - playlisttodf - Input: sp; playlist(ID, URI or URL) - Get a specific playlist and put it in a data frame. - Require base Spotify authentication for public playlists or user authentication for private playlists (typically "sp"). - Output: Pandas data frame - topartistsdf - Input: sp - Get the top artists of the current authenticated user and put it in a data frame. - Require user authentication call (typically "sp"). - Output: Pandas data frame - toptracksdf - Input: sp; (OPTIONAL: limit; timerange) - timerange can be either "longterm", "middleterm" or "shortterm". - Get the top tracks of the current authenticated user and put it in a data frame. - Require user authentication call (typically "sp"). - Output: Pandas data frame - trackanalysistodf - Input: sp, list(ID, URI or URL) - Get raw audio analysis and put it in a data frame. - Require either base - Output: Pandas data frame - ttesttotable - Input: data frame 1, data frame 2, drop list - Test the difference between each data frame of similar column names - Output: Pandas data frame
Owner
- Name: Steffen Rygg Aasen
- Login: a-asen
- Kind: user
- Location: Tromsø, Norway
- Company: UiT The Arctic University of Norway
- Website: https://a-asen.github.io/
- Repositories: 13
- Profile: https://github.com/a-asen
PhD Candidate in Cognitive Neuroscience at UiT The Arctic University of Norway
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Aasen" given-names: "Steffen Rygg" title: "Spotify Visualizing" version: 1.0 date-released: 2023.04.12 software: [Visualizing Script] url: "https://github.com/a-asen/Spotify_Visualizing"