Name | datafiller JSON |
Version |
0.1.2
JSON |
| download |
home_page | None |
Summary | A python package for easy data imputation |
upload_time | 2025-09-17 16:17:45 |
maintainer | None |
docs_url | None |
author | Cyril Joly |
requires_python | None |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/CyrilJl/datafiller/main/docs/_static/datafiller_light.svg">
<img alt="datafiller logo" src="https://raw.githubusercontent.com/CyrilJl/datafiller/main/docs/_static/datafiller_dark.svg" width="50%" height="50%">
</picture>
[](https://badge.fury.io/py/datafiller)
[](https://github.com/CyrilJl/datafiller/actions/workflows/ci-pipeline.yml)
[](https://codecov.io/github/CyrilJl/datafiller)
[](https://datafiller.readthedocs.io/en/latest/?badge=latest)
</div>
**DataFiller** is a Python library for imputing missing values in datasets. It provides a flexible and powerful way to handle missing data in both numerical arrays and time series data.
## Key Features
- **Model-Based Imputation**: Uses machine learning models (like linear regression) to predict and fill missing values.
- **Time Series Support**: A dedicated ``TimeSeriesImputer`` that automatically creates lagged and lead features for imputation.
- **Efficient**: Leverages Numba for performance-critical sections.
- **Smart Feature Selection**: Finds the optimal subset of data to use for training imputation models.
- **Scikit-Learn Compatible**: Integrates with the scikit-learn ecosystem.
## Installation
You can install DataFiller using pip:
```bash
pip install datafiller
```
## Basic Usage
### Imputing a NumPy Array
The ``MultivariateImputer`` can be used to fill missing values (`NaN`) in a 2D NumPy array.
```python
import numpy as np
from datafiller import MultivariateImputer
# Create a matrix with missing values
X = np.array([
[1.0, 2.0, 3.0, 4.0],
[5.0, np.nan, 7.0, 8.0],
[9.0, 10.0, 11.0, np.nan],
[13.0, 14.0, 15.0, 16.0],
])
# Initialize the imputer and fill the missing values
imputer = MultivariateImputer()
X_imputed = imputer(X)
print("Original Matrix:")
print(X)
print("\nImputed Matrix:")
print(X_imputed)
```
### Imputing a Time Series DataFrame
The ``TimeSeriesImputer`` is designed to work with pandas DataFrames that have a ``DatetimeIndex``. It automatically creates autoregressive features (lags and leads) to improve imputation accuracy.
```python
import pandas as pd
import numpy as np
from datafiller import TimeSeriesImputer
# Create a time series DataFrame with missing values
rng = pd.date_range('2023-01-01', periods=10, freq='D')
data = {
'feature1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'feature2': [10, 9, np.nan, 7, 6, 5, np.nan, 3, 2, 1],
}
df = pd.DataFrame(data, index=rng)
# Initialize the imputer with lags and leads
# Use t-1 and t+1 to impute missing values
ts_imputer = TimeSeriesImputer(lags=[1, -1])
df_imputed = ts_imputer(df)
print("Original DataFrame:")
print(df)
print("\nImputed DataFrame:")
print(df_imputed)
```
## How It Works
DataFiller uses a model-based imputation strategy. For each column containing missing values, it trains a regression model using the other columns as features. The rows used for training are carefully selected to be the largest, most complete rectangular subset of the data, which is found using the ``optimask`` algorithm. This ensures that the training data is of the highest possible quality, leading to more accurate imputations.
For more details, see the [documentation](https://datafiller.readthedocs.io/).
Raw data
{
"_id": null,
"home_page": null,
"name": "datafiller",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Cyril Joly",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/79/c6/90c57f29308384e2f100ba14af059c0bf6dafaf7a1360d5e86df4a775628/datafiller-0.1.2.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n<picture>\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/CyrilJl/datafiller/main/docs/_static/datafiller_light.svg\">\n <img alt=\"datafiller logo\" src=\"https://raw.githubusercontent.com/CyrilJl/datafiller/main/docs/_static/datafiller_dark.svg\" width=\"50%\" height=\"50%\">\n</picture>\n\n[](https://badge.fury.io/py/datafiller)\n[](https://github.com/CyrilJl/datafiller/actions/workflows/ci-pipeline.yml)\n[](https://codecov.io/github/CyrilJl/datafiller)\n[](https://datafiller.readthedocs.io/en/latest/?badge=latest)\n\n\n</div>\n\n**DataFiller** is a Python library for imputing missing values in datasets. It provides a flexible and powerful way to handle missing data in both numerical arrays and time series data.\n\n## Key Features\n\n- **Model-Based Imputation**: Uses machine learning models (like linear regression) to predict and fill missing values.\n- **Time Series Support**: A dedicated ``TimeSeriesImputer`` that automatically creates lagged and lead features for imputation.\n- **Efficient**: Leverages Numba for performance-critical sections.\n- **Smart Feature Selection**: Finds the optimal subset of data to use for training imputation models.\n- **Scikit-Learn Compatible**: Integrates with the scikit-learn ecosystem.\n\n## Installation\n\nYou can install DataFiller using pip:\n\n```bash\npip install datafiller\n```\n\n## Basic Usage\n\n### Imputing a NumPy Array\n\nThe ``MultivariateImputer`` can be used to fill missing values (`NaN`) in a 2D NumPy array.\n\n```python\nimport numpy as np\nfrom datafiller import MultivariateImputer\n\n# Create a matrix with missing values\nX = np.array([\n [1.0, 2.0, 3.0, 4.0],\n [5.0, np.nan, 7.0, 8.0],\n [9.0, 10.0, 11.0, np.nan],\n [13.0, 14.0, 15.0, 16.0],\n])\n\n# Initialize the imputer and fill the missing values\nimputer = MultivariateImputer()\nX_imputed = imputer(X)\n\nprint(\"Original Matrix:\")\nprint(X)\nprint(\"\\nImputed Matrix:\")\nprint(X_imputed)\n```\n\n### Imputing a Time Series DataFrame\n\nThe ``TimeSeriesImputer`` is designed to work with pandas DataFrames that have a ``DatetimeIndex``. It automatically creates autoregressive features (lags and leads) to improve imputation accuracy.\n\n```python\nimport pandas as pd\nimport numpy as np\nfrom datafiller import TimeSeriesImputer\n\n# Create a time series DataFrame with missing values\nrng = pd.date_range('2023-01-01', periods=10, freq='D')\ndata = {\n 'feature1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n 'feature2': [10, 9, np.nan, 7, 6, 5, np.nan, 3, 2, 1],\n}\ndf = pd.DataFrame(data, index=rng)\n\n# Initialize the imputer with lags and leads\n# Use t-1 and t+1 to impute missing values\nts_imputer = TimeSeriesImputer(lags=[1, -1])\ndf_imputed = ts_imputer(df)\n\nprint(\"Original DataFrame:\")\nprint(df)\nprint(\"\\nImputed DataFrame:\")\nprint(df_imputed)\n```\n\n## How It Works\n\nDataFiller uses a model-based imputation strategy. For each column containing missing values, it trains a regression model using the other columns as features. The rows used for training are carefully selected to be the largest, most complete rectangular subset of the data, which is found using the ``optimask`` algorithm. This ensures that the training data is of the highest possible quality, leading to more accurate imputations.\n\nFor more details, see the [documentation](https://datafiller.readthedocs.io/).\n",
"bugtrack_url": null,
"license": null,
"summary": "A python package for easy data imputation",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://datafiller.readthedocs.io",
"Homepage": "https://github.com/CyrilJl/datafiller"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "023b8fef98b0061f84c05b0c69fcd6177cccb12511047d1a9dba873457e8aff2",
"md5": "3d7601a79566a0aa4adca81c1c55bc25",
"sha256": "009a8e978e62b530c32408e22efa36e102cf78c7e692c6e0dabdc6f71fabe6d6"
},
"downloads": -1,
"filename": "datafiller-0.1.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "3d7601a79566a0aa4adca81c1c55bc25",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 25036,
"upload_time": "2025-09-17T16:17:43",
"upload_time_iso_8601": "2025-09-17T16:17:43.656249Z",
"url": "https://files.pythonhosted.org/packages/02/3b/8fef98b0061f84c05b0c69fcd6177cccb12511047d1a9dba873457e8aff2/datafiller-0.1.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "79c690c57f29308384e2f100ba14af059c0bf6dafaf7a1360d5e86df4a775628",
"md5": "351f43d310423eee13ae1846f6913105",
"sha256": "847bb99a7bb62588cae6c765152281188206ddb72214bd3dbb37f955fcf6027d"
},
"downloads": -1,
"filename": "datafiller-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "351f43d310423eee13ae1846f6913105",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27814,
"upload_time": "2025-09-17T16:17:45",
"upload_time_iso_8601": "2025-09-17T16:17:45.048521Z",
"url": "https://files.pythonhosted.org/packages/79/c6/90c57f29308384e2f100ba14af059c0bf6dafaf7a1360d5e86df4a775628/datafiller-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-17 16:17:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CyrilJl",
"github_project": "datafiller",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datafiller"
}