liveBook · Manning

Pandas

As explained in Build Python Web Apps with Streamlit

pandas is a Python library for data manipulation and analysis, especially with labeled and tabular data.

pandas is a Python library for manipulating and analyzing tabular data. Its central structure, the dataframe, represents rows and typed columns like a spreadsheet table, making structured data easier to load, inspect, select, and reshape. section 1.3.7 section 6.2.1

A practical pandas workflow includes:

  • Install the library with pip, then import it conventionally as pd. section 6.2.1
  • Load a CSV file into a dataframe with pd.read_csv('sales_data.csv'). section 6.2.1
  • Inspect the result with type() and info(), including its row count, columns, data types, and memory usage. section 6.2.1
  • Select columns with square-bracket notation, filter rows, and prepare data for analysis or visualization. section 6.2.1 section 6.6

Sales dashboard data

A metrics dashboard can load sales_data.csv into df, inspect more than a million sales records, and select fields such as date, product_name, segment, and state. pandas can then wrangle the data into forms suitable for Plotly line and pie charts displayed in Streamlit. section 6.2 section 6.5

>>> df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1035000 entries, 0 to 1034999
Data columns (total 10 columns):
 #   Column        Non-Null Count    Dtype
---  ------        --------------    -----
 0   date          1035000 non-null  object
 1   product_name  1035000 non-null  object
 2   segment       1035000 non-null  object
 3   category      1035000 non-null  object
 4   gender        1035000 non-null  object
 5   age_group     1035000 non-null  object
 6   state         1035000 non-null  object
 7   sales         1035000 non-null  float64
 8   gross_margin  1035000 non-null  float64
 9   transactions  1035000 non-null  float64
dtypes: float64(3), object(7)
memory usage: 79.0+ MB

Inspect a dataframe’s structure through a concrete info() output showing rows, columns, types, non-null counts, and memory usage. section 6.2.1

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains installation, CSV loading, dataframe inspection, column selection, and visualization preparation without detailing advanced dataframe operations.
Examples
Uses sales_data.csv, a large sales dataframe, column subsets, dataframe inspection, and dashboard charts as concrete examples.
What it assumes
Assumes basic Python execution and CSV familiarity while teaching dataframe concepts, pandas installation, imports, and initial inspection.
What you can do after
Build data-loading and dashboard workflows that inspect, select, and prepare tabular records for interactive analysis and charts.
How it connects
Connects dataframes with CSV files, Streamlit, Plotly, data visualization, caching, and dashboard metrics.

Also explained in

Compare how 11 books explain pandas →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.