Giter Club home page Giter Club logo

rolling-stones-lab-nyc-career-ds-062518's Introduction

Rolling Stones Lab

Getting Started

In this exercise, we will be using data from the top 500 rolling stone albums. We have this data contained in the data.csv file. We will be building out the following functions to answer questions and interact with this data.

remember: reading from a csv file in python looks like the following:

import csv

    with open(file_name) as f:
        # we are using DictReader because we want our information to be in dictionary format.
        reader = csv.DictReader(f)
        # some more code

Once we have our reader reading our file as dictionaries, we want our data to be a list of dictionaries. So, we need to loop through our reader and create a list. *hint: list comprehension / for loops are your friend"

# our data will look something like this once we have read it and turned it into a list of `OrderedDict`s
# don't worry, the ordered dicts look different but we can interact with them the same way we do normal dicts
[OrderedDict([('number', '1'), ('year', '1967'), ('album', "Sgt. Pepper's Lonely Hearts Club Band"), ('artist', 'The Beatles'), ('genre', 'Rock'), ('subgenre', 'Rock & Roll, Psychedelic Rock')]), OrderedDict([('number', '2'), ('year', '1966'), ('album', 'Pet Sounds'), ('artist', 'The Beach Boys'), ('genre', 'Rock'), ('subgenre', 'Pop Rock, Psychedelic Rock')]), OrderedDict([('number', '3'), ('year', '1966'), ('album', 'Revolver'), ('artist', 'The Beatles'), ('genre', 'Rock'), ('subgenre', 'Psychedelic Rock, Pop Rock')])]

After we have our data formated the way we want it, we can now begin working on defining our functions.

Functions to build-out:

Each of the following functions can be defined in the functions.py file.

  • Searching functions
    • Find by name - Takes in a string that represents the name of an album. Should return a dictionary with the correct album, or return None.
    • Find by rank - Takes in a number that represents the rank in the list of top albums and returns the album with that rank. If there is no album with that rank, it returns None.
    • Find by year - Takes in a number for the year in which an album was released and returns a list of albums that were released in that year. If there are no albums released in the given year, it returns an empty list.
    • Find by years - Takes in a start year and end year. Returns a list of all albums that were released on or between the start and end years. If no albums are found for those years, then an empty list is returned.
    • Find by ranks - Takes in a start rank and end rank. Returns a list of albums that are ranked between the start and end ranks. If no albums are found for those ranks, then an empty list is returned.
  • All functions
    • All titles - Returns a list of titles for each album.
    • All artists - Returns a list of artist names for each album.
  • Questions to answer / functions
    • Artists with the most albums - Returns the artist with the highest amount of albums on the list of top albums
    • Most popular word - Returns the word used most in amongst all album titles
    • Histogram of albums by decade - Returns a histogram with each decade pointing to the number of albums released during that decade.
    • Histogram by genre - Returns a histogram with each genre pointing to the number of albums that are categorized as being in that genre.

rolling-stones-lab-nyc-career-ds-062518's People

Contributors

jeffkatzy avatar tkoar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.