update} QUESTIONS AND ANSWERS 100%
CORRECT
What is the mean of the column "A" in this dataframe generated below? (choose the
closest value)(you may need to import additional packages to run the below code!)
Import numpy as np
Rng = np.random.default_rng(768561456987365)
#create a dataframe using those random values!Df =
pd.dataframe(rng.integers(0,100,size=(15, 4)), columns=list('ABCD')) - correct answer
58.13
First create a simple dataframe using the below code.import pandas as pd# create a
list of lists data = [['A1', 2, 4, 8], ['A2', 3, 7, 17], ['A3', 1, None, 7], ['A4', 989, 186, 3698], ['A5',
,0, 0 ,None]]# Create the pandas dataframe df= pd.dataframe(data, columns=['ID', 'Value
1', 'Value 2','Value 3'])
Df
If you ran:
Df = df.dropna()
Df
How many rows would remain in the dataframe? - correct answer 3
What package have we been using to import our data, and what is the abbreviation
(as..) We have been using?
,This would look something like the below in a line of code. Note I am not asking what
would work... But rather what has been demonstrated in the class notebooks. - correct
answer import "pandas" as "pd"
Assume we have all packages in place we need. Assume all spaces etc are correct.
Canvas sometimes shows strange gaps etc. Let's download the "homes.csv" file
located in the Canvas file folder under the data tab.
What code do we need to import that dataframe? Use the code we have been using
from the notebooks. There are many ways to do this, but the demonstrated approach is
the most popular convention. So make sure you type that in. Assume the data file is in
the same folder and location as your code. In other words you do not need to create a
relative path or any path for that matter. You just need the name of the file. We will not
use a path variable. Just the name of the file.
, Note that in week 3 we did this with the "segments.csv" dataset, so you could refer to
that as an example. - correct answer homes = pd.read_csv("homes.csv")
Import the homes dataset mentioned in the quiz intro. It is in Canvas called
"homes.csv". Let's explore a little bit.
Match following operators with their respective definition: (Greater than or equal to,
less than, not equal to, greater than, equal to, less than or equal to) - correct answer
greater than or equal to ( >= )
Less than ( < )
Not equal to ( != )
Greater than ( > )