FlashKeepers

Data Science · College · College and University

pandas I: DataFrames and Selection

pandas Series and DataFrame, loc and iloc, boolean masks, missing data, sorting, dtypes and reading files.

About this set

40 basic cards for College Data Science. Set 1 of 2 in pandas. It opens with "What is a pandas Series?" and "What is a pandas DataFrame?". Study it alongside the other College sets below.

40 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a pandas Series?
Show answerA one-dimensional array-like object with a labeled index
What is a pandas DataFrame?
Show answerA two-dimensional table-like object with labeled rows and columns
How do you create a Series from a list?
Show answerpd.Series([1, 2, 3, 4])
How do you create a DataFrame from a dictionary?
Show answerpd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
What does loc select data by?
Show answerLabel-based indexing using row and column labels
What does iloc select data by?
Show answerInteger position-based indexing
What is the key difference between loc and iloc?
Show answerloc uses labels, iloc uses integer positions
What is a boolean mask in pandas?
Show answerA Series or array of True/False values used to filter rows or columns
How do you apply a boolean mask to filter a DataFrame?
Show answerdf[df['column'] > value]
What is NaN in pandas?
Show answerNot a Number, the standard representation of missing values
How do you detect missing values in a DataFrame?
Show answerUse df.isna() or df.isnull()
What does dropna() remove?
Show answerRows or columns containing NaN values
What does fillna() do?
Show answerReplaces NaN values with specified values
How do you sort a Series in ascending order?
Show answerseries.sort_values()
How do you sort a DataFrame by a specific column?
Show answerdf.sort_values(by='column_name')

25 more cards in the app

Study this set free