A pandas DataFrame is a labeled table of rows and columns. It gives business data a working shape: load each CSV into a DataFrame, inspect what the columns contain, then decide how the tables can support a question. A column name is not proof of what its values mean. section 2.3 section 2.5.4
Before analyzing a new DataFrame, make a few quick checks:
- Use `head()` to see sample rows, `shape` to check size, and `info()` to inspect columns and non-null counts. section 2.3
- Use `describe()`, `isna().sum()`, and `value_counts()` to investigate values and gaps. Ask why values are missing before filling or deleting them. section 2.3 section 2.5.2
- Check duplicates, data types, and relationships between tables before trusting calculations or joins. section 2.5.1 section 2.5.4
Joining reviews to customers
Suppose you want a customer identifier beside each order review. An AI-suggested merge on `customer_id` looks convenient, but the reviews do not contain that column. First connect orders to customers on `customer_id`; then connect reviews to that result on `order_id`. Inspect the identifiers and resulting rows rather than accepting a plausible-looking join. section 2.6.4
merged_df = df_order_reviews.merge(orders_customers[['order_id', 'customer_unique_id']], on='order_id', how='left')
This second merge adds `customer_unique_id` to reviews through `order_id`, using the orders-and-customers DataFrame created first. section 2.6.4
A DataFrame can also hold a result, not just imported records. Merging reviews, orders, items, and products makes it possible to count review scores by product category and seller; grouping produces another DataFrame for a chart or table. If a result has thousands of rows, aggregate or visualize it to answer the business question. Generated code still needs execution and inspection: a basic positive-review keyword filter, for example, does not automatically handle missing comments or nuanced wording. section 3.3.3 section 4.4 section 5.5.6


















