Skip to main content

Build Codecov

microdf

Weighted pandas DataFrames and Series for survey microdata analysis.

Overview

microdf provides MicroDataFrame and MicroSeries classes that extend pandas functionality with integrated weighting support, essential for accurate survey data analysis.

Key Features

  • MicroDataFrame: A pandas DataFrame with an integrated weight column
  • MicroSeries: A pandas Series with integrated weights
  • Weighted operations: All aggregations (sum, mean, median, etc.) automatically use weights
  • Inequality metrics: Built-in Gini coefficient calculation
  • Poverty analysis: Integrated poverty rate and gap calculations

Installation

Install with:

pip install microdf-python

Or for development:

pip install git+https://github.com/PolicyEngine/microdf.git

Usage

import microdf as mdf
import pandas as pd

# Create sample data with weights
df = pd.DataFrame(
    {"income": [10_000, 20_000, 30_000, 40_000, 50_000], "weights": [1, 2, 3, 2, 1]}
)

# Create a MicroDataFrame
mdf_df = mdf.MicroDataFrame(df, weights="weights")

# All operations are weight-aware
print(mdf_df.income.mean())  # Weighted mean
print(mdf_df.income.gini())  # Gini coefficient

Questions

Contact the maintainer, Max Ghenis (max@policyengine.org).

Citation

You may cite the source of your analysis as "microdf release #.#.#, author's calculations."

Metadata

Release files for microdf-python 1.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microdf-python 1.5.3
File Size Uploaded
microdf_python-1.5.3.tar.gz 60.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for microdf-python 1.5.3
File Interpreter ABI Platform
microdf_python-1.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 128.4 kB

Release files / microdf_python-1.5.3.tar.gz

Download URL microdf_python-1.5.3.tar.gz
Size 60.3 kB
Tags Source
SHA-256 checksum
How to use checksums
93e83249f3a5c5493c8c7a9ade6d5f4d3e6a52903c08dbf6fc8fe8abd49ea1b4
BLAKE2b-256 checksum
How to use checksums
8cce3df6660e48aecdc2c58cba30a0f98ac46b5195f26736f3c749c9991d5e8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / microdf_python-1.5.3-py3-none-any.whl

Download URL microdf_python-1.5.3-py3-none-any.whl
Size 68.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34c5fb76f1c0a16069ed3ef022cd90edaf9a31332ea7cb7bacafa798452b40c1
BLAKE2b-256 checksum
How to use checksums
b5e07e7d7469ca54a55fd6e94d0c2ae5550cad4995e1657c8698c658cf0de1d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

1.5.11

2 release files

1.5.10

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

This release

1.5.3 This release

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.10

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page