Python Final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

To specify unlimited number of parameters in a function, use _____

(*lots_of_parameters )

You can supply multiple column names (col1, col2) to the drop function using

.drop( columns = ​['col1', 'col2'] )

df.drop(columns= 'Name' , inplace = True)

Nothing - there is no return value

To find unique records, use ___

df​[column].unique()

How would we delete all the rows with invalid cell data?

dropna

A Pandas DataFrame is most resembles _____.

A table of rows and columns

print( data​['100']) The line of code above will print:

Data with index 100

Query function modifies the data frame and converts it to contain a subset of the data

Fales

def function_name ( *lots_of_values ): lots_of_values is a _____.

tuple parameter

Which of the following are true about return values?

A function can return only one value A function can return only one value, which can in turn contain multiple values

How do you EDIT cell at row 26 and column 'ABC'?

df.loc ​[26, 'ABC'] = value

A DataFrame ALWAYS has rows and columns

True - it's two dimensional

A query function selects ____ from a data frame.

a subset of rows

A Pandas DataFrame is most similar to ____

a table of data

def exponent(base, exponent): base = 2 exponent = 3 return base ** exponent power = base ** exponent return power

8

Arguments MUST be provided in the order listed in a method definition

Mostly True.... but you can use kwargs to provide arguments in any order.

For a student dataframe that contains student info, the names column has student names.student_df​['name'].str.contains("jr.")

One series of boolean values indicating which rows have "jr." in the name

import pandas as pd url="https://raw.githubusercontent.com/xyz.csv" file_df = pd.read_csv(url) df = pd.DataFrame(df )

Program won't run - df is being used before it is defined!

A Pandas series is most similar to ____

a column of data

Column names with spaces should be enclosed in ____ within Pandas queries.

back quotes ''

Which of the following keywords creates a new function?

def

import pandas as pd url="https://raw.githubusercontent.com/xyz.csv" df = pd.read_csv(url) df2 = pd.DataFrame( _____ )

df

How would we drop a row that has a value "adf2234" at index row 26?

df.drop(index=26)

How can you get index numbers for all the rows of a data frame?

df.index

How do we change all na values to a specific value?

fillna

How would we look up how many null values there are in the dataframe?

info()

To look at column headers for a DataFrame, you can use ___

info() head() tail()

If you want to make changes to the original dataframe, use ___.

inplace=True

When a function returns a value, it ______.

is given back to the caller function invisibly

A Series in Pandas likely contains ____.

single column and multiple rows

The purpose of keyword arguments is _____.

to allow specification of arguments out of order by using argument names


Ensembles d'études connexes

Physical Geology - Online Lab Quiz 08B

View Set

Chapter 3 Drug Action Across the Life Span, Chapter 10 the older patient

View Set

Module 11 Maslow and Rogers: Humanistic Approach (pt1)

View Set

Economics Unit 1 Lesson 2 Part 2

View Set