Flashcards · Pandas · Free
Pandas flashcards, generated for you.
Example Pandas study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Pandas flashcards
What is a pandas Series and how does it differ from a DataFrame?
A Series is a 1D labeled array (like a single column), while a DataFrame is a 2D table with rows and columns. Both have index labels; DataFrames also have column names.
How do you select a single column from a DataFrame df named 'age'?
Use df['age'] or df.age. Both return a Series. Use df[['age']] (double brackets) to return a DataFrame.
What is the difference between .loc[] and .iloc[] in pandas?
.loc[] uses label-based indexing (row/column names); .iloc[] uses integer position-based indexing (0, 1, 2, etc.).
How do you filter a DataFrame to rows where age > 30?
Use df[df['age'] > 30]. This creates a boolean mask and applies it to return matching rows.
What does .groupby() return and why is it useful for analysis?
A GroupBy object that segments data by one or more columns, enabling aggregation (sum, mean, count) within each group—essential for exploratory analysis and summarization.
How do you compute the mean salary by department?
Use df.groupby('department')['salary'].mean(). This groups by department and calculates the mean of salary within each group.
What is the purpose of .merge() and how does it differ from .join()?
.merge() joins DataFrames on column values (SQL-like); .join() joins on index by default. .merge() is more flexible for key-based joins across different columns.
How do you handle missing values in a pandas DataFrame?
Use .isnull() or .isna() to detect NaN values; .dropna() removes rows/columns with missing values; .fillna(value) replaces them with a specified value.
What is the difference between .apply() and .map()?
.apply() works on Series or entire DataFrames with functions; .map() works only on Series for element-wise transformation, often with dictionaries. Use .apply() for flexibility.
How do you pivot a DataFrame from long to wide format?
Use .pivot(index='row_col', columns='col_col', values='val_col'). This reshapes data so that unique values in col_col become new column headers.
Make your own Pandas study set
Flashcards for related topics
Studying Pandas to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →