Data with pandas
NumPy, pandas and statistics: reading files, formatting numbers, describing distributions.
- Analysing Balance Sheet Financial Ratios with Python and pandas
Load a balance sheet into pandas, check that it balances, and compute liquidity and leverage ratios, year-on-year changes and a common-size view in a few lines.
- Binomial Distribution and Binomial Test in Python with SciPy
Compute binomial probabilities with scipy.stats.binom and run an exact binomial test with scipy.stats.binomtest: p-values, one-sided tests and confidence intervals.
- Continuous and Discrete Uniform Distributions in Python (PDF, CDF, Sampling)
Work with continuous and discrete uniform distributions in Python: scipy.stats.uniform and randint, PDF, PMF, CDF, quantiles, sampling with NumPy and fit tests.
- Fix UnicodeDecodeError When Reading a CSV File in pandas
Why pd.read_csv raises UnicodeDecodeError: 'utf-8' codec can't decode byte, and how to fix it with the right encoding, BOM handling and UTF-8 conversion.
- How to Suppress Scientific Notation in pandas and NumPy
Stop pandas and NumPy printing floats like 1.2e+09: set_printoptions(suppress=True), display.float_format, option_context, Styler and to_csv.
- Kurtosis in Python: SciPy, pandas and NumPy Explained
Compute kurtosis in Python with scipy.stats.kurtosis, pandas Series.kurt and NumPy. Excess vs Pearson, the bias flag, worked examples and how to interpret it.
- Poisson Distribution and Poisson Process in Python
Model event counts with scipy.stats.poisson (pmf, cdf, sf, ppf) and simulate a Poisson process in NumPy from exponential gaps, with checks against theory.
- Python Tutorial: Analysing Public Property-Price Data with pandas
A runnable pandas tutorial on HM Land Registry Price Paid Data (Open Government Licence v3.0): load a headerless 160 MB CSV with the right dtypes, filter standard sales, compute median prices by month and district, pivot by property type and plot a chart.
- pandas Missing Values: Find, Count, Fill and Drop NaN Without Skewing Your Results
How pandas represents missing data (NaN, None, pd.NA), how to make read_csv recognise your own placeholders, count gaps with isna, drop rows with dropna, fill them with fillna, ffill or interpolate, and the silent effects of NaN on sums, means, groupby and integer columns.
- pandas groupby: How to Group and Aggregate Data in Python
How pandas groupby works: sum and mean per group, several keys, named aggregation with agg, transform, filter, missing keys, dates and the pandas 3 defaults.
- pandas merge, join and concat: Combine DataFrames Without Losing Rows
How to combine DataFrames in pandas: pd.merge with inner, left, right and outer joins, indicator=True to find unmatched rows, left_on and right_on, suffixes, validate to catch duplicate keys, DataFrame.join on the index, pd.concat for stacking, and the key-type errors that make a merge return nothing.
- pandas pivot_table, pivot and melt: Reshape Data Between Long and Wide
How to reshape DataFrames in pandas: pivot_table to aggregate into a cross-table, pivot when every cell is unique and why it raises 'Index contains duplicate entries', melt to go back from wide to long, crosstab for counts and percentages, flattening MultiIndex columns, and the pandas 3.0 change to observed.
- pandas read_excel and to_excel: Read and Write Excel Files Without Losing Data
How to read .xlsx files with pandas read_excel (sheets, header rows, columns, dtypes, dates and missing values), write one or several sheets with to_excel and ExcelWriter, append to an existing workbook, and avoid the classic traps: leading zeros, auto-converted dates and the wrong engine.







