Lab 2: Read and Working with Data using Pandas This lab will introduce you to using open source software written in Python and authored by other individuals. Popular open source software projects in...

Lab 2: Read and Working with Data using Pandas


This lab will introduce you to using open source software written in Python and authored by other individuals. Popular open source software projects in Python that are relevant to this program include:


Lab 2.a: Introduction to Pandas and Numpy Data Structures


Review the following documentation from Pandas about data structures: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html (Links to an external site.). This will introduce you to the
Series
and
DataFrame. There is no need to read about Panels unless you would like to). You will see references to
numpy arrays
which you can review separately in this tutorial (Links to an external site.) from the Data Science Handbook.



Deliverables:


Code for creating and printing a 2 by 3 numpy array of random numbers


Code for creating a Series of 5 random numbers with indexes from 0 to 4


Code for creating a DataFrame containing two Series of 5 random numbers and indexed with the letters “a” through “e”


Lab 2.b: Reading CSV files into DataFrames


DataFrames are useful for performing calculations so we typically will read a CSV or other data file into a DataFrame before doing more calculations. Review the following documentation from Pandas for reading a CSV file into a DataFrame. Explore the methods available for DataFrames as well (e.g. df.head(10) ).


When you read in data, it will be messy. Research how to clean the data in the DataFrame on your own:


User Guide for Pandas IO Tools (Links to an external site.)


Getting Data in and Out (Links to an external site.)


Pandas.read_csv Documentation (Links to an external site.)


Pandas.to_csv Documentation (Links to an external site.)



Deliverables:


Code for reading the CSV file into a Pandas DataFrame


Code for cleaning the data (e.g. convert strings to integers and floats)


Code for writing a cleaner DataFrame to a new CSV file







May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here