Question
Overview: You will explore Pandas series and data frame containers and the functions and methods available for these Python containers. You will then use these
Overview: You will explore Pandas series and data frame containers and the functions and methods available for these Python containers. You will then use these methods and functions to analyze a CSV data set.
Instructions:
This lab requires two additional files to be downloaded: Pokemon.csv
Part 1 - Observe and Practice (40 points) Through Anaconda Navigator, open Jupyter Notebook. Copy each group of code snippets below into a cell on Jupyand run the code. Copy the output after the code and explain what the code is doing.
a) Series
import pandas as pd series1 = pd.Series([1, 2, 3, 4]) series1
type(series1)
series2 = pd.Series([1, 2, 3, 4], index = ['a','b','c','d']) series2
series3 = series2[1:3] series3
b) Data Frames
list_of_fruit = [['apple', 10], ['mango', 12], ['banana', 13]] fruit_df = pd.DataFrame(list_of_fruit, columns = ['fruit','count']) fruit_df
fruit_dict = {'fruit':['apple','mango','banana'], 'count':[10, 12, 13]} fruit_df = pd.DataFrame(fruit_dict) fruit_df
sub_df = fruit_df[1:] sub_df
student_dict = {'FirstName': ['Larry', 'Moe', 'Curly'], 'LastName': ['Smith', 'Howard', 'Jones'], 'Midterm': [88.5, 67.8, 92.0], "Final":[78.9, 93.2, 65.5]} grades = pd.DataFrame(student_dict) grades
grades.iloc[:4, 1:3]
grades.loc[:3,'Midterm']
grades['GPA'] = [2.3, 2.7, 3.1]
grades.head(2)
c) Data Analysis, CSV files
Note: The following code must be updated to the full file path on your computer. The 'r' must proceed with the file name, so backslash characters are not interpreted as escape characters.
poke = pd.read_csv(r'DriveLetter\full path\Pokemon.csv') type(poke)
poke.shape
poke.info
poke.head()
poke.tail()
type(poke.index)
poke.iloc[:,1]
poke.loc[:5, "Name"]
poke.sum()
poke.mean()
poke.describe()
poke.sort_values(by="Name")
poke.set_index("Name")
filter1 = poke["Speed"] >60 filter1
filter_data = poke[filter1]
filter_data
PLEASE SEE BELOW FOR LINK TO POKEMON.CSV
https://drive.google.com/file/d/1aQV9cZbw4uNgHH1-l0ulljvv_YRPUenC/view?usp=sharing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started