import pandas as pd
import numpy as np
# Below is for an interactive display of DataFrame in Colab
from google.colab import data_table
data_table.enable_dataframe_formatter()Classwork 15
Pandas Fundamental V-1: Reshaping DataFrames
Question 1. Persoanl Income in New York State
ny_pincp = pd.read_csv('https://bcdanl.github.io/data/NY_pinc_wide.csv')The following is the ny_pincp DataFrame:
- Reshape
ny_pincpto a longer format.- Make sure the resulting DataFrame has county-year as the unit of observation.
- New York county FIPS code:
- A 5-digit geographic identifier for a county in New York State.
- The first 2 digits are the state FIPS code for New York (
36). - The last 3 digits identify the county within New York.
- Example:
36001= Albany County36055= Monroe County36063= Niagara County
Answer:
Question 2. COVID-19 Cases
covid = pd.read_csv('https://bcdanl.github.io/data/covid19_cases.csv')The following is the covid DataFrame:
- Create a wide-form data frame from
covidin which:- variable names come from
countriesAndTerritories, and - values come from
cases.
- variable names come from
Answer:
Discussion
Welcome to our Classwork 15 Discussion Board! ๐
This space is designed for you to engage with your classmates about the material covered in Classwork 15.
Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.
If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 15 materials or need clarification on any points, donโt hesitate to ask here.
All comments will be stored here.
Letโs collaborate and learn from each other!