Name | cccd JSON |
Version |
0.1.1
JSON |
| download |
home_page | |
Summary | Generate csv files with descriptions of the data in a header |
upload_time | 2024-01-29 22:19:54 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.11 |
license | MIT License Copyright (c) 2023 Wojciech Sadowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
metadata
data documentation
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# c3d - create & comment `csv` data files
A small library for post-processing of data (currently only csv) files:
**generating metadata and documentation of included data sets**
## Usage example
A minimal working example looks like that:
```python
import os
import cccd as cdf
ds = cdf.DataSet("Data", "The description of the data set.")
ds.append("Value_1", "The description of the value nr. 1.", 42)
ds.append("Value_2", "The description of the second value.", 69)
# we decide to save all of our results here
results_f = "example_results"
if not os.path.exists(results_f):
os.mkdir(results_f)
cdf.write_ds(ds, f"{results_f}/ex1.csv")
```
Here, we have a dataset called `Data` with a description. We also have two
values that belong to the dataset. We also provide a description of the values.
Finally, we save it all in `ex1.csv` file that looks as follows:
```
# Data:
# The description of the data set.
#
# Value_1:
# The description of the value nr. 1.
#
# Value_2:
# The description of the second value.
#
Value_1,Value_2
42,69
```
A more involved example (including metadata and some customisation) below:
```python
import os
import cccd as cdf
import polars as pl
if __name__ == "__main__":
# ingest the raw data
test_data = pl.read_csv("examples/test.csv")
data_set = cdf.DataSet(
"This is the dataset nr. 1",
"The description of the data set and each field can be long. It will"
" be wrapped anyway. I could even put Lorem Ipsum here.",
)
# lets describe the raw data that we have
data_set.append(
"f1", # name
"This data describes f1 and is very meaningful!", # description
test_data[
"first"
], # value, currently it should be a Series or something like that
)
# We can create the DataDescription here and pass it to our dataset. This
# is not very convienent as we have to also make sure that the second arg
# is a dataframe.
data_set.append_data_raw(
cdf.DataDescription("f2", "Second data set. Not very meanigful."),
pl.DataFrame({"f2": test_data["second"]}),
)
# we decide to save all of our results here
results_f = "example_results"
if not os.path.exists(results_f):
os.mkdir(results_f)
# We will write the described dataset, including metadata.
mdata = cdf.metadata(
author="James Bond", time_stamp=True, count_lines=True
)
# We will also overwrite the comment sign to `--` like in `lua`.
cdf.write_ds(
data_set,
f"{results_f}/ex2.csv",
meta_data=mdata,
comment_text="--",
)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "cccd",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "metadata,data documentation",
"author": "",
"author_email": "Wojciech Sadowski <wojciech1sadowski@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6b/1d/d5193a90149622b5c04bb5c4507d5afbc9058f422f8563d5d789f7e6c8a5/cccd-0.1.1.tar.gz",
"platform": null,
"description": "# c3d - create & comment `csv` data files \n\nA small library for post-processing of data (currently only csv) files:\n**generating metadata and documentation of included data sets**\n\n## Usage example \nA minimal working example looks like that:\n```python\nimport os\nimport cccd as cdf\n\nds = cdf.DataSet(\"Data\", \"The description of the data set.\")\n ds.append(\"Value_1\", \"The description of the value nr. 1.\", 42)\n ds.append(\"Value_2\", \"The description of the second value.\", 69)\n\n# we decide to save all of our results here\nresults_f = \"example_results\"\nif not os.path.exists(results_f):\n os.mkdir(results_f)\n\ncdf.write_ds(ds, f\"{results_f}/ex1.csv\")\n```\nHere, we have a dataset called `Data` with a description. We also have two \nvalues that belong to the dataset. We also provide a description of the values.\nFinally, we save it all in `ex1.csv` file that looks as follows:\n```\n# Data:\n# The description of the data set.\n#\n# Value_1:\n# The description of the value nr. 1.\n#\n# Value_2:\n# The description of the second value.\n#\nValue_1,Value_2\n42,69\n\n```\n\nA more involved example (including metadata and some customisation) below:\n```python\nimport os\nimport cccd as cdf\nimport polars as pl\n\nif __name__ == \"__main__\":\n\n # ingest the raw data\n test_data = pl.read_csv(\"examples/test.csv\")\n\n data_set = cdf.DataSet(\n \"This is the dataset nr. 1\",\n \"The description of the data set and each field can be long. It will\"\n \" be wrapped anyway. I could even put Lorem Ipsum here.\",\n )\n\n # lets describe the raw data that we have\n data_set.append(\n \"f1\", # name\n \"This data describes f1 and is very meaningful!\", # description\n test_data[\n \"first\"\n ], # value, currently it should be a Series or something like that\n )\n\n # We can create the DataDescription here and pass it to our dataset. This\n # is not very convienent as we have to also make sure that the second arg\n # is a dataframe.\n data_set.append_data_raw(\n cdf.DataDescription(\"f2\", \"Second data set. Not very meanigful.\"),\n pl.DataFrame({\"f2\": test_data[\"second\"]}),\n )\n\n # we decide to save all of our results here\n results_f = \"example_results\"\n if not os.path.exists(results_f):\n os.mkdir(results_f)\n\n # We will write the described dataset, including metadata.\n mdata = cdf.metadata(\n author=\"James Bond\", time_stamp=True, count_lines=True\n )\n # We will also overwrite the comment sign to `--` like in `lua`.\n cdf.write_ds(\n data_set,\n f\"{results_f}/ex2.csv\",\n meta_data=mdata,\n comment_text=\"--\",\n )\n```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Wojciech Sadowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Generate csv files with descriptions of the data in a header",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/szynka12/cccd"
},
"split_keywords": [
"metadata",
"data documentation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6c8e1f8f0250f165a419acbab88647fe20197dcdaed267edb243387aae336461",
"md5": "bbbabbe2bc113d6222a848c725c41ab8",
"sha256": "c67c68e80aaf485a5e364d90a35618fb3d9f24a8a471bfc4350284e5e9abd2e8"
},
"downloads": -1,
"filename": "cccd-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bbbabbe2bc113d6222a848c725c41ab8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 7257,
"upload_time": "2024-01-29T22:19:52",
"upload_time_iso_8601": "2024-01-29T22:19:52.208622Z",
"url": "https://files.pythonhosted.org/packages/6c/8e/1f8f0250f165a419acbab88647fe20197dcdaed267edb243387aae336461/cccd-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b1dd5193a90149622b5c04bb5c4507d5afbc9058f422f8563d5d789f7e6c8a5",
"md5": "5f885d0a57dc996ad6b4e542b78bd7d2",
"sha256": "62972864aa99f7a8a9d35d156874ebd3b49f2d018d7339d76a5350f6aec31356"
},
"downloads": -1,
"filename": "cccd-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "5f885d0a57dc996ad6b4e542b78bd7d2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 7466,
"upload_time": "2024-01-29T22:19:54",
"upload_time_iso_8601": "2024-01-29T22:19:54.274612Z",
"url": "https://files.pythonhosted.org/packages/6b/1d/d5193a90149622b5c04bb5c4507d5afbc9058f422f8563d5d789f7e6c8a5/cccd-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-29 22:19:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "szynka12",
"github_project": "cccd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "cccd"
}