

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Import the dataset Boston_housing_data.csv with the locationid column being an integer. Use print() to see the dataset as output. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) data = df.head(5) print(data) Displays the number of rows and columns in the dataframe stored as df. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) print(df.shape) Display the column names in the dataframe stored as df. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) print(list(df.columns.values)) Display the mean, count, min, and max of all the numeric data using a single line of code in the dataframe stored as df. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) data = df.describe() print(data) Display the variable type of each column in the dataframe stored as df. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) print (df.dtypes) Display unique values in the locationzone column in dataframe stored as df. - โโ df = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) uniqueValues = df['locationzone'].unique() print('Unique elements in column "locationzone" ') print(uniqueValues)
Display the unique values in the locationzone column and the number of times each value appears in the dataframe stored as df. - โโdf = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) data = df['locationzone'].value_counts() print(data) Import the data set Boston_housing_data_clean.csv with the locationid column being an integer. Use print() to see the data set as output. - โโdf = pd.read_csv('/home/ucertify/Boston_housing_data_clean.csv',dtype={'locationid':np.int64}) print(df) Display any duplicate rows in the dataframe stored as df. - โโdf = pd.read_csv('/home/ucertify/Boston_housing_data.csv',dtype={'locationid':np.int64}) duplicatedRows = df.loc[df.duplicated()] print('Duplicated rows in "Boston_housing_data_clean" ') print(duplicatedRows) Ensure there are no missing observations in the dataframe stored as df. - โโdf = pd.read_csv('/home/ucertify/Boston_housing_data_clean.csv',dtype={'locationid':np.int64}) data = df.isnull().sum() print(data) Display the mean value of the medv column per district on March 27, 2016. To do this, limit the dataset to observations that were appraised on March 27, 2016, and create a datasheet that aggregates all the data by the locationdistrict column and displays the mean of medv rounded off to one decimal place. - โโdf = pd.read_csv('/home/ucertify/Boston_housing_data_clean.csv',dtype={'locationid':np.int64}) df2 = df.loc[df['date_appraised'] == '2016- 03 - 27'] df3 = df2.groupby('locationdistrict' ['medv'].mean().round(1) print(df3) Import the dataset iris.csv and display the first five rows. - โโdf = pd.read_csv('/home/ucertify/iris.csv') print (df.head())