Pandas Library Fundamentals
- 37Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- āPrevious card
- āNext card
What is pandas?
An open-source Python library designed for data manipulation and analysis.
Or swipe the card
37 cards
What is pandas?
An open-source Python library designed for data manipulation and analysis.
What is the standard way to import pandas?
import pandas as pdWhat are the two core data structures in pandas?
Series (1D labeled array) and DataFrame (2D labeled data structure).
What is a DataFrame in pandas?
A two-dimensional tabular data structure with labeled rows and columns, similar to a spreadsheet or SQL table.
Why is pandas faster than using Python lists for tabular data?
Pandas is built on NumPy, which uses C-based operations and avoids Python's overhead.
How do you install pandas?
Run
pip install pandason Windows orpip3 install pandason Mac/Linux.How can you set up a virtual environment for pandas using UV?
Run
uv init .in the project folder, thenuv add pandas. Useuv runto execute Python files.What is a Jupyter notebook and why is it useful for pandas?
An interactive environment where code is written in cells that can be run independently, ideal for data exploration.
How do you load a CSV file into a DataFrame?
df = pd.read_csv('filename.csv')What does pandas automatically assign to each row when loading data?
A default index starting from 0.
How can you create a DataFrame from a dictionary?
pd.DataFrame({'column1': values1, 'column2': values2})What does
df.head()do?Returns the first 5 rows of the DataFrame by default.
What does
df.tail()do?Returns the last 5 rows of the DataFrame by default.
What information does
df.info()provide?Number of entries, column names and their data types, non-null counts, and memory usage.
What does
df.describe()do?Generates descriptive statistics (count, mean, std, min, quartiles, max) for numeric columns.
How do you get a list of all column names in a DataFrame?
df.columnsHow do you get the index (row labels) of a DataFrame?
df.indexHow do you select a single column from a DataFrame?
df['column_name']ordf.column_name(if column name is a valid Python identifier).How do you select multiple columns from a DataFrame?
df[['col1', 'col2']]What is the difference between
ilocandloc?ilocuses integer-based indexing (row number), whilelocuses label-based indexing (row index label or boolean condition).How do you select a single row by integer position?
df.iloc[row_index]How do you filter rows in a DataFrame?
df[df['column'] == value]How do you apply multiple conditions with AND in pandas?
Use
&between conditions, each enclosed in parentheses:df[(cond1) & (cond2)]How do you apply multiple conditions with OR in pandas?
Use
|between conditions, each enclosed in parentheses:df[(cond1) | (cond2)]How can you filter rows using string methods on a column?
df[df['column'].str.startswith('prefix')]or.str.endswith('suffix')How do you filter rows where a column's value is in a given list?
df[df['column'].isin([val1, val2, ...])]How do you negate a filter condition in pandas?
Use the tilde operator (
~) before the condition:df[~cond]How do you update a specific cell or set of cells based on a condition?
df.loc[condition, 'column'] = new_valueHow can you transform an entire column (e.g., make it uppercase)?
df['column'] = df['column'].str.upper()How do you drop a row by its index?
df.drop(row_index)How do you drop rows with any missing values?
df.dropna()How do you fill missing values with a specific value?
df.fillna(value, inplace=True)How do you rename a column?
df.rename(columns={'old_name': 'new_name'}, inplace=True)What does
df['column'].value_counts()do?Returns a Series with counts of each unique value in the column.
How do you perform a groupby operation to compute a sum?
df.groupby('group_col')['value_col'].sum()How do you sort a DataFrame by a column?
df.sort_values('column', ascending=True)How do you save a DataFrame to a CSV file?
df.to_csv('filename.csv', index=True/False)

Ask anything
We've read this whole study set, so questions about it get the best answers.