{ "info": { "author": "JWDT", "author_email": "pypi@johken.uk", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "A simple tool that uses a JSON config file (or a config dict) to convert one CSV to another.\n\nSimplest use case is to just list the new headers and link them to the old headers, like so:\n\n```json\n{\n\"New Column Header One\": \"Old Column Header One\",\n\"New Column Header Two\": \"Old Column Header Two\"\n}\n```\n\nA slightly more useful version specifies a default to use (implemented using the \"or\" operator `value_from_old_column or default`):\n\n```json\n{\n \"New Header One\": {\n \"old_column\": \"Old Header One\",\n \"default\": \"DEFAULT VALUE FOR ONE\"\n },\n \"New Header Two\": {\n \"old_column\": \"Old Header Two\",\n \"default\": \"DEFAULT VALUE FOR TWO\"\n }\n}\n```\n\nThe third and final currently implemented option is to use a lambda function (use of full functions is planned):\n\n```json\n{\n \"New Header One\": {\n \"old_column\": \"Old Header One\",\n \"default\": \"DEFAULT FOR ONE\",\n \"lambda\": \"lambda a, b: str(a.get(b.get('old_column'))).lower()\"\n },\n \"New Header Two\": {\n \"old_column\": \"Old Header Two\",\n \"default\": \"DEFAULT FOR TWO\",\n \"lambda\": \"lambda a, b: str(a.get(b.get('old_column'))).lower()\"\n }\n}\n```\n\nIt will run the lambda as:\n\n```python\nitem['lambda'] = \"lambda a, b: str(a.get(b.get('old_column'))).lower()\"\nexec(f\"c = {item.get('lambda')}\", globals())\nreturn c(line, item)\n```\n\nWhere `line` is the current line of the source CSV, and `item` is the current element from the JSON file (the current column).\n\n## Usage: \n\n```python\nfrom csv_converter import CSVConverter\nconverter = CSVConverter(config_file_name='path-to-config.json')\noutput = converter.convert(input_file_name='path-to-source.csv')\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/JWDT/csv_converter", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "csv-converter", "package_url": "https://pypi.org/project/csv-converter/", "platform": "", "project_url": "https://pypi.org/project/csv-converter/", "project_urls": { "Homepage": "https://github.com/JWDT/csv_converter" }, "release_url": "https://pypi.org/project/csv-converter/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Tool to convert CSV files based on JSON config.", "version": "0.0.4" }, "last_serial": 5590517, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "71e1c1327831f61a99b3f374cec1b3f0", "sha256": "30b27cf81a6aa8e674c496b172754884ee1c7bc6af15d0d3a7965370652c7215" }, "downloads": -1, "filename": "csv_converter-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "71e1c1327831f61a99b3f374cec1b3f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4586, "upload_time": "2019-07-26T19:26:57", "url": "https://files.pythonhosted.org/packages/d3/62/20900212fd2f316492935a2a6aa1df7bf79dc9fa827180ad9387c74d7e9e/csv_converter-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5ef6df62368fc7f6535cb45ba800ec2b", "sha256": "a27d4afeead8fcc5b6482b0aaee488cd1716cf6072f38fcfea66ba7bb5c1cc35" }, "downloads": -1, "filename": "csv_converter-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5ef6df62368fc7f6535cb45ba800ec2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3050, "upload_time": "2019-07-26T19:26:59", "url": "https://files.pythonhosted.org/packages/06/0d/2a4ab0cbf944522dbd61c854e0407f9bf246542210cdfcd9873d933c077e/csv_converter-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "31ae48302c08d53031971938491ec21c", "sha256": "7c48c72f19a0b606582db1418b2a038adf4a12a9049b431f3592e4a7231e19b8" }, "downloads": -1, "filename": "csv_converter-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "31ae48302c08d53031971938491ec21c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4598, "upload_time": "2019-07-26T19:41:34", "url": "https://files.pythonhosted.org/packages/08/2b/246f471535a8521827a8d01f1ddb4b17c5e38d249430b44ccffddc00b9ce/csv_converter-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6dc10aa0fdeb4019112b7f2535b85e4", "sha256": "c3a9fb4a415ebd777dd6c4bdf4a814064e4e73268f9d74d4bbe34d7388d7a998" }, "downloads": -1, "filename": "csv_converter-0.0.3.tar.gz", "has_sig": false, "md5_digest": "f6dc10aa0fdeb4019112b7f2535b85e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3056, "upload_time": "2019-07-26T19:41:36", "url": "https://files.pythonhosted.org/packages/c4/69/0b0734ae68ee81b7e6ee0330a535f8be7b2190d0db273bf8594cdb2811cb/csv_converter-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "8ad654b05504aa5aacebfe364154ad2a", "sha256": "44ec7ba3ca6e927d33dd51d7cba570890fcd62a3458b374af966f916ba21a1ea" }, "downloads": -1, "filename": "csv_converter-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8ad654b05504aa5aacebfe364154ad2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4616, "upload_time": "2019-07-26T19:50:35", "url": "https://files.pythonhosted.org/packages/a5/de/8d8a57db057ecc17b0c04db21f39f423e15121400fcde0ca49a5942032ff/csv_converter-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "377819ca3d987991ca37e55b818027a1", "sha256": "dbee91c8f792e7273ffc0d51f9c3d62f94c9fecae82facf964b3296e9ead579b" }, "downloads": -1, "filename": "csv_converter-0.0.4.tar.gz", "has_sig": false, "md5_digest": "377819ca3d987991ca37e55b818027a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3079, "upload_time": "2019-07-26T19:50:36", "url": "https://files.pythonhosted.org/packages/05/56/f9e65ef569c65d766b52914b144f8b6941af8140c0e3c8a086ea04eadd4a/csv_converter-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8ad654b05504aa5aacebfe364154ad2a", "sha256": "44ec7ba3ca6e927d33dd51d7cba570890fcd62a3458b374af966f916ba21a1ea" }, "downloads": -1, "filename": "csv_converter-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8ad654b05504aa5aacebfe364154ad2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4616, "upload_time": "2019-07-26T19:50:35", "url": "https://files.pythonhosted.org/packages/a5/de/8d8a57db057ecc17b0c04db21f39f423e15121400fcde0ca49a5942032ff/csv_converter-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "377819ca3d987991ca37e55b818027a1", "sha256": "dbee91c8f792e7273ffc0d51f9c3d62f94c9fecae82facf964b3296e9ead579b" }, "downloads": -1, "filename": "csv_converter-0.0.4.tar.gz", "has_sig": false, "md5_digest": "377819ca3d987991ca37e55b818027a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3079, "upload_time": "2019-07-26T19:50:36", "url": "https://files.pythonhosted.org/packages/05/56/f9e65ef569c65d766b52914b144f8b6941af8140c0e3c8a086ea04eadd4a/csv_converter-0.0.4.tar.gz" } ] }