pivot vs pivot_table in pandas
`pivot` reshapes unique values only, while `pivot_table` can aggregate duplicates.
- pivot needs unique index-column pairs
- pivot_table accepts aggfunc
- pivot_table is safer for real data
Quick recall
`pivot` reshapes unique values only, while `pivot_table` can aggregate duplicates.
Limit parsed columns, set dtypes intentionally, and stream large files in chunks when needed.
A Series is one labeled column, while a DataFrame is a 2D labeled table of columns.
It happens when pandas is unsure whether you are writing to a view or a detached copy.
`explode` turns each item in a list-like cell into its own row while repeating the other column values.
Vectorization means using array-style operations on whole columns instead of Python loops over rows.
Use categorical dtype for repeated low-cardinality labels to save memory and make category semantics explicit.
Convert early with `to_datetime`, then use the `.dt` accessor for filtering, grouping, and feature extraction.
The ORM improves productivity with composable queries, model validation, and database abstraction.
Function-based views are explicit and simple, while class-based views reduce repetition through reusable behavior and inheritance.
Cache expensive work at the right layer: low-level data, per-view output, or template fragments.
Django splits concerns into models, views, and templates, with the framework routing requests between them.