{"id":34967280,"url":"https://github.com/mews-labs/dataframe-memory","last_synced_at":"2026-05-22T00:04:16.205Z","repository":{"id":205338555,"uuid":"714000335","full_name":"mews-labs/dataframe-memory","owner":"mews-labs","description":"This tools aims to provide simple solution to save memory when using pandas' data frame. ","archived":false,"fork":false,"pushed_at":"2023-11-21T09:33:33.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T15:14:02.159Z","etag":null,"topics":["data","data-science","memory-usage","pandas-dataframe","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mews-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-03T17:35:08.000Z","updated_at":"2025-08-27T12:35:30.000Z","dependencies_parsed_at":"2025-02-20T17:56:07.298Z","dependency_job_id":null,"html_url":"https://github.com/mews-labs/dataframe-memory","commit_stats":null,"previous_names":["eurobios-mews-labs/dataframe-memory","mews-labs/dataframe-memory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mews-labs/dataframe-memory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mews-labs%2Fdataframe-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mews-labs%2Fdataframe-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mews-labs%2Fdataframe-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mews-labs%2Fdataframe-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mews-labs","download_url":"https://codeload.github.com/mews-labs/dataframe-memory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mews-labs%2Fdataframe-memory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28064328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","data-science","memory-usage","pandas-dataframe","python3"],"created_at":"2025-12-26T23:17:20.428Z","updated_at":"2025-12-26T23:17:22.735Z","avatar_url":"https://github.com/mews-labs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dataframe Memory Project\n\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/eurobios-mews-labs/dataframe-memory/graphs/commit-activity)\n[![PyPI version](https://badge.fury.io/py/dataframe-memory.svg)](https://badge.fury.io/py/dataframe-memory)\n\nThis tools aims to provide simple solution to save memory when using pandas' data frame.\nIt is highly inspired by this [kaggle post](https://www.kaggle.com/gemartin/load-data-reduce-memory-usage).\n\n\u003e [!IMPORTANT]\n\u003e The very basic principle : for each column, this tool reduces int and float precision as much as possible so that\n\u003e\n\u003e 1. **Approximate method** `method='approx'` : no duplicated values appear and  the minimum and maximum can be re-encoded\n\u003e 2. **Exact method**   `method='exact'` : preserve absolute information by testing every value.\n\u003e \n\u003e For object data type, the function is trying to create category. \n\n### Installation\n\n\n```shell\npip install dataframe-memory\n```\n\n### Usage\n\n````python\nfrom data_memory import reduce_memory\nimport numpy as np\nimport pandas as pd\n\ndf = pd.DataFrame(\n    np.array(\n        [[1, 2, \"aaa\"],\n         [4, 5, \"bbb\"],\n         [7, 8, \"ccc\"]] * 10000),\n    columns=['a', 'b', 'c'])\n\nreduce_memory(df, method=\"exact\", verbose=True)\n````\nYields the following decrease of memory\n````text\nMemory usage input: 5.04 MB\nMemory usage output: 0.09 MB\nDecreased by: 98.28 % \n````\n````python\ndf.info()\n````\n\n````text\n #   Column  Non-Null Count  Dtype   \n---  ------  --------------  -----   \n 0   a       30000 non-null  category\n 1   b       30000 non-null  category\n 2   c       30000 non-null  category\n````\n\n\u003e [!WARNING] \n\u003e  In `method='approx'`, \n\u003e 1. This tool **destroys** information and **should not be applied automatically** to any dataframe but big ones\n\u003e 2. It preserves relative but not absolute information \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmews-labs%2Fdataframe-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmews-labs%2Fdataframe-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmews-labs%2Fdataframe-memory/lists"}