{"id":15672626,"url":"https://github.com/thombashi/dataproperty","last_synced_at":"2025-04-26T18:58:28.218Z","repository":{"id":60722203,"uuid":"52094644","full_name":"thombashi/DataProperty","owner":"thombashi","description":"A Python library for extract property from data.","archived":false,"fork":false,"pushed_at":"2024-12-31T14:36:12.000Z","size":1120,"stargazers_count":16,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T15:13:54.627Z","etag":null,"topics":["data","property","python","python-library"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/DataProperty","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thombashi.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2016-02-19T14:54:52.000Z","updated_at":"2025-04-09T10:10:54.000Z","dependencies_parsed_at":"2022-10-03T20:47:46.843Z","dependency_job_id":null,"html_url":"https://github.com/thombashi/DataProperty","commit_stats":{"total_commits":1368,"total_committers":4,"mean_commits":342.0,"dds":"0.48318713450292394","last_synced_commit":"4654928ad3b669be69ffbe733408fd816d14653e"},"previous_names":[],"tags_count":138,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2FDataProperty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2FDataProperty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2FDataProperty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2FDataProperty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thombashi","download_url":"https://codeload.github.com/thombashi/DataProperty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250868820,"owners_count":21500346,"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","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","property","python","python-library"],"created_at":"2024-10-03T15:29:05.580Z","updated_at":"2025-04-25T17:57:14.335Z","avatar_url":"https://github.com/thombashi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. contents:: **DataProperty**\n   :backlinks: top\n   :local:\n\n\nSummary\n=======\nA Python library for extract property from data.\n\n\n.. image:: https://badge.fury.io/py/DataProperty.svg\n    :target: https://badge.fury.io/py/DataProperty\n    :alt: PyPI package version\n\n.. image:: https://anaconda.org/conda-forge/DataProperty/badges/version.svg\n    :target: https://anaconda.org/conda-forge/DataProperty\n    :alt: conda-forge package version\n\n.. image:: https://img.shields.io/pypi/pyversions/DataProperty.svg\n   :target: https://pypi.org/project/DataProperty\n    :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/implementation/DataProperty.svg\n    :target: https://pypi.org/project/DataProperty\n    :alt: Supported Python implementations\n\n.. image:: https://github.com/thombashi/DataProperty/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/thombashi/DataProperty/actions/workflows/ci.yml\n    :alt: CI status of Linux/macOS/Windows\n\n.. image:: https://coveralls.io/repos/github/thombashi/DataProperty/badge.svg?branch=master\n    :target: https://coveralls.io/github/thombashi/DataProperty?branch=master\n    :alt: Test coverage\n\n.. image:: https://github.com/thombashi/DataProperty/actions/workflows/github-code-scanning/codeql/badge.svg\n    :target: https://github.com/thombashi/DataProperty/actions/workflows/github-code-scanning/codeql\n    :alt: CodeQL\n\n\nInstallation\n============\n\nInstallation: pip\n------------------------------\n::\n\n    pip install DataProperty\n\nInstallation: conda\n------------------------------\n::\n\n    conda install -c conda-forge dataproperty\n\nInstallation: apt\n------------------------------\n::\n\n    sudo add-apt-repository ppa:thombashi/ppa\n    sudo apt update\n    sudo apt install python3-dataproperty\n\n\nUsage\n=====\n\nExtract property of data\n------------------------\n\ne.g. Extract a ``float`` value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e DataProperty(-1.1)\n    data=-1.1, type=REAL_NUMBER, align=right, ascii_width=4, int_digits=1, decimal_places=1, extra_len=1\n\ne.g. Extract a ``int`` value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e DataProperty(123456789)\n    data=123456789, type=INTEGER, align=right, ascii_width=9, int_digits=9, decimal_places=0, extra_len=0\n\ne.g. Extract a ``str`` (ascii) value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e DataProperty(\"sample string\")\n    data=sample string, type=STRING, align=left, length=13, ascii_width=13, extra_len=0\n\ne.g. Extract a ``str`` (multi-byte) value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e str(DataProperty(\"吾輩は猫である\"))\n    data=吾輩は猫である, type=STRING, align=left, length=7, ascii_width=14, extra_len=0\n\ne.g. Extract a time (``datetime``) value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e import datetime\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e DataProperty(datetime.datetime(2017, 1, 1, 0, 0, 0))\n    data=2017-01-01 00:00:00, type=DATETIME, align=left, ascii_width=19, extra_len=0\n\ne.g. Extract a ``bool`` value property\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n.. code:: python\n\n    \u003e\u003e\u003e from dataproperty import DataProperty\n    \u003e\u003e\u003e DataProperty(True)\n    data=True, type=BOOL, align=left, ascii_width=4, extra_len=0\n\n\nExtract data property for each element from a matrix\n----------------------------------------------------\n``DataPropertyExtractor.to_dp_matrix`` method returns a matrix of ``DataProperty`` instances from a data matrix.\nAn example data set and the result are as follows:\n\n:Sample Code:\n    .. code:: python\n\n        import datetime\n        from dataproperty import DataPropertyExtractor\n\n        dp_extractor = DataPropertyExtractor()\n        dt = datetime.datetime(2017, 1, 1, 0, 0, 0)\n        inf = float(\"inf\")\n        nan = float(\"nan\")\n\n        dp_matrix = dp_extractor.to_dp_matrix([\n            [1, 1.1, \"aa\", 1, 1, True, inf, nan, dt],\n            [2, 2.2, \"bbb\", 2.2, 2.2, False, \"inf\", \"nan\", dt],\n            [3, 3.33, \"cccc\", -3, \"ccc\", \"true\", inf, \"NAN\", \"2017-01-01T01:23:45+0900\"],\n        ])\n\n        for row, dp_list in enumerate(dp_matrix):\n            for col, dp in enumerate(dp_list):\n                print(\"row={:d}, col={:d}, {}\".format(row, col, str(dp)))\n\n:Output:\n    ::\n\n        row=0, col=0, data=1, type=INTEGER, align=right, ascii_width=1, int_digits=1, decimal_places=0, extra_len=0\n        row=0, col=1, data=1.1, type=REAL_NUMBER, align=right, ascii_width=3, int_digits=1, decimal_places=1, extra_len=0\n        row=0, col=2, data=aa, type=STRING, align=left, ascii_width=2, length=2, extra_len=0\n        row=0, col=3, data=1, type=INTEGER, align=right, ascii_width=1, int_digits=1, decimal_places=0, extra_len=0\n        row=0, col=4, data=1, type=INTEGER, align=right, ascii_width=1, int_digits=1, decimal_places=0, extra_len=0\n        row=0, col=5, data=True, type=BOOL, align=left, ascii_width=4, extra_len=0\n        row=0, col=6, data=Infinity, type=INFINITY, align=left, ascii_width=8, extra_len=0\n        row=0, col=7, data=NaN, type=NAN, align=left, ascii_width=3, extra_len=0\n        row=0, col=8, data=2017-01-01 00:00:00, type=DATETIME, align=left, ascii_width=19, extra_len=0\n        row=1, col=0, data=2, type=INTEGER, align=right, ascii_width=1, int_digits=1, decimal_places=0, extra_len=0\n        row=1, col=1, data=2.2, type=REAL_NUMBER, align=right, ascii_width=3, int_digits=1, decimal_places=1, extra_len=0\n        row=1, col=2, data=bbb, type=STRING, align=left, ascii_width=3, length=3, extra_len=0\n        row=1, col=3, data=2.2, type=REAL_NUMBER, align=right, ascii_width=3, int_digits=1, decimal_places=1, extra_len=0\n        row=1, col=4, data=2.2, type=REAL_NUMBER, align=right, ascii_width=3, int_digits=1, decimal_places=1, extra_len=0\n        row=1, col=5, data=False, type=BOOL, align=left, ascii_width=5, extra_len=0\n        row=1, col=6, data=Infinity, type=INFINITY, align=left, ascii_width=8, extra_len=0\n        row=1, col=7, data=NaN, type=NAN, align=left, ascii_width=3, extra_len=0\n        row=1, col=8, data=2017-01-01 00:00:00, type=DATETIME, align=left, ascii_width=19, extra_len=0\n        row=2, col=0, data=3, type=INTEGER, align=right, ascii_width=1, int_digits=1, decimal_places=0, extra_len=0\n        row=2, col=1, data=3.33, type=REAL_NUMBER, align=right, ascii_width=4, int_digits=1, decimal_places=2, extra_len=0\n        row=2, col=2, data=cccc, type=STRING, align=left, ascii_width=4, length=4, extra_len=0\n        row=2, col=3, data=-3, type=INTEGER, align=right, ascii_width=2, int_digits=1, decimal_places=0, extra_len=1\n        row=2, col=4, data=ccc, type=STRING, align=left, ascii_width=3, length=3, extra_len=0\n        row=2, col=5, data=True, type=BOOL, align=left, ascii_width=4, extra_len=0\n        row=2, col=6, data=Infinity, type=INFINITY, align=left, ascii_width=8, extra_len=0\n        row=2, col=7, data=NaN, type=NAN, align=left, ascii_width=3, extra_len=0\n        row=2, col=8, data=2017-01-01T01:23:45+0900, type=STRING, align=left, ascii_width=24, length=24, extra_len=0\n\n\nFull example source code can be found at *examples/py/to_dp_matrix.py*\n\n\nExtract properties for each column from a matrix\n------------------------------------------------------\n``DataPropertyExtractor.to_column_dp_list`` method returns a list of ``DataProperty`` instances from a data matrix. The list represents the properties for each column.\nAn example data set and the result are as follows:\n\nExample data set and result are as follows:\n\n:Sample Code:\n    .. code:: python\n\n        import datetime\n        from dataproperty import DataPropertyExtractor\n\n        dp_extractor = DataPropertyExtractor()\n        dt = datetime.datetime(2017, 1, 1, 0, 0, 0)\n        inf = float(\"inf\")\n        nan = float(\"nan\")\n\n        data_matrix = [\n            [1, 1.1,  \"aa\",   1,   1,     True,   inf,   nan,   dt],\n            [2, 2.2,  \"bbb\",  2.2, 2.2,   False,  \"inf\", \"nan\", dt],\n            [3, 3.33, \"cccc\", -3,  \"ccc\", \"true\", inf,   \"NAN\", \"2017-01-01T01:23:45+0900\"],\n        ]\n\n        dp_extractor.headers = [\"int\", \"float\", \"str\", \"num\", \"mix\", \"bool\", \"inf\", \"nan\", \"time\"]\n        col_dp_list = dp_extractor.to_column_dp_list(dp_extractor.to_dp_matrix(dp_matrix))\n\n        for col_idx, col_dp in enumerate(col_dp_list):\n            print(str(col_dp))\n\n:Output:\n    ::\n\n        column=0, type=INTEGER, align=right, ascii_width=3, bit_len=2, int_digits=1, decimal_places=0\n        column=1, type=REAL_NUMBER, align=right, ascii_width=5, int_digits=1, decimal_places=(min=1, max=2)\n        column=2, type=STRING, align=left, ascii_width=4\n        column=3, type=REAL_NUMBER, align=right, ascii_width=4, int_digits=1, decimal_places=(min=0, max=1), extra_len=(min=0, max=1)\n        column=4, type=STRING, align=left, ascii_width=3, int_digits=1, decimal_places=(min=0, max=1)\n        column=5, type=BOOL, align=left, ascii_width=5\n        column=6, type=INFINITY, align=left, ascii_width=8\n        column=7, type=NAN, align=left, ascii_width=3\n        column=8, type=STRING, align=left, ascii_width=24\n\n\nFull example source code can be found at *examples/py/to_column_dp_list.py*\n\n\nDependencies\n============\n- Python 3.9+\n- `Python package dependencies (automatically installed) \u003chttps://github.com/thombashi/DataProperty/network/dependencies\u003e`__\n\nOptional dependencies\n---------------------\n- `loguru \u003chttps://github.com/Delgan/loguru\u003e`__\n    - Used for logging if the package installed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthombashi%2Fdataproperty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthombashi%2Fdataproperty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthombashi%2Fdataproperty/lists"}