my code is # importing pandas for csv file operations import pandas as pd # filename to store the filename, change it to your filename fileName = 'survey.csv' # Creating a dataframe by opening the given file df = pd.read_csv(fileName) # converting the date string to datetime pd.to_datetime(df['Timestamp']) Question - Python code to drop the data values from your data set where the age is less than 1 or greater than 99 BY USING DROP FUNCTION. DO NOT CHANGE ORIGINAL DATA FRAME Example of function required is df_data.drop(df_data[df_data.salary<0].index,inplace=True) • Print the shape of your new data frame using the shape property. • Has the number of columns changed? • Has the number of rows changed? • Explain why each has or has not changed.
my code is
# importing pandas for csv file operations
import pandas as pd
# filename to store the filename, change it to your filename
fileName = 'survey.csv'
# Creating a dataframe by opening the given file
df = pd.read_csv(fileName)
# converting the date string to datetime
pd.to_datetime(df['Timestamp'])
Question - Python code to drop the data values from your data set where the age is less than 1 or greater than 99 BY USING DROP FUNCTION.
DO NOT CHANGE ORIGINAL DATA FRAME
Example of function required is df_data.drop(df_data[df_data.salary<0].index,inplace=True)
• Print the shape of your new data frame using the shape property.
• Has the number of columns changed?
• Has the number of rows changed?
• Explain why each has or has not changed.
Step by step
Solved in 3 steps