{ "info": { "author": "Anthony Manning-Franklin", "author_email": "anthony.manning.franklin@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "csvputty\n========\n\n*Command-fu with csv files*\n\nA set of command line interfaces and python modules for easily\nmanipulating, transforming and dealing with csv files quickly and\neffectively.\n\nCLI Usage\n---------\n\nAll csvputty commands start with ``csvputty``, optionally any\ninput/output files you wish to use, and then the command you wish to\nperform.\n\nIf you do not supply i/o files then csvputty will use stdin/stdout\ninstead.\n\nExample:\n\n``$ csvputty -i data.csv -o out.txt``\n\nmarkup\n~~~~~~\n\nThis command will take the selected columns of a CSV file, process each\nrow through a format string, and return the collective output. For\nexample:\n\n``$ csvputty -i data.csv -o rendered.html markup 0 1 3 template.html``\n\nThis parses each row of ``data.csv`` using the content of\n``template.html`` as a format string and saves to ``rendered.html``.\n\nIn the above example, ``template.html`` could be the following:\n\n.. code:: html\n\n
\n
{}
\n
{}
\n
{}
\n
\n\nor\n\n.. code:: html\n\n
\n
{coconuts}
\n
{cheese}
\n
{sausages}
\n
\n\nIf used with the ``-h --header`` flag the first row of the CSV is used\nto key the template.\n\nHowever csvputty really becomes useful in the full context of the\ncommand line. Take the following example:\n\n``$ cat data1.csv data2.csv | csvputty -o rendered.html markup 0 1 template.html``\n\nThis passes ``data1.csv`` and ``data2.csv`` through the same template\nand renders them together in a single file.\n\n``csvputty -i data.csv markup 0 1 -``\n\nThis opens stdin allowing you to enter the template via command line and\nprints the results to stdout.\n\ndiff\n~~~~\n\nDiff compares the input CSV against another CSV and outputs rows where\nselected columns fulfil the match condition.\n\n``$ cat subtract1.csv subtract2.csv | csvputty -i source.csv -o out.csv diff -sc 18 -``\n\nThe above example returns rows from ``source.csv`` where column 18 is\nnot found on column column 0 anywhere in ``subtract1.csv`` or\n``subtract2.csv``.\n\nPackage Usage\n-------------\n\nImporting csvputty into your project allows you to use some features\nunavailable via the command line interface.\n\nFor example:\n\n.. code:: python\n\n import csvputty\n\n\n def parse_row(row, row_index):\n for idx, col in enumerate(row):\n row[idx] = col.strip().replace(\"&\", \"&\")\n img_url = row[2].lower().replace(\" \", \"_\").replace('&', 'and')\n insta_url = row[4].replace(\"@\", \"\")\n\n return (img_url, row[1], insta_url, row[3], row[6])\n\n\n input = open('data.csv', 'r')\n out = open('rendered.html', 'w')\n template = open('template.html', 'r')\n\n csvputty.markup.generate(custom_row_parser=parse_row, csv_file=input\n template_file=template, out_file=out)\n\nThe above example allows me to strip whitespace and replace ampersands\nwith html entities on all columns, and perform further processing on\nother columns.", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Antman261/csvputty", "keywords": "csv command line cli", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "csvputty", "package_url": "https://pypi.org/project/csvputty/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/csvputty/", "project_urls": { "Homepage": "https://github.com/Antman261/csvputty" }, "release_url": "https://pypi.org/project/csvputty/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "CSV CLI utility functions and packages in Python.", "version": "0.1.0" }, "last_serial": 2782024, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "24232bd73dcd876ad02c666a1e301fba", "sha256": "1a5785d42665696915c42f9e7b2e00454dfda14d5b4ac3e25ab58a1bc268dfff" }, "downloads": -1, "filename": "csvputty-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "24232bd73dcd876ad02c666a1e301fba", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8284, "upload_time": "2017-04-11T14:10:55", "url": "https://files.pythonhosted.org/packages/38/b4/8939dbe3181f4c2c4c3ddb7da036a6e19d0820d104bac2ccf435da6c89ab/csvputty-0.1.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "24232bd73dcd876ad02c666a1e301fba", "sha256": "1a5785d42665696915c42f9e7b2e00454dfda14d5b4ac3e25ab58a1bc268dfff" }, "downloads": -1, "filename": "csvputty-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "24232bd73dcd876ad02c666a1e301fba", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8284, "upload_time": "2017-04-11T14:10:55", "url": "https://files.pythonhosted.org/packages/38/b4/8939dbe3181f4c2c4c3ddb7da036a6e19d0820d104bac2ccf435da6c89ab/csvputty-0.1.0-py3-none-any.whl" } ] }