Skip to main content

A cli tool to split csv files

Project description

CSV-Split

Vertical splitting (columns)

Splits a given CSV file vertically. Accepts either a batch-size, or a split-pattern to create multiple files from a single files. All files will contain different columns of original csv. Order of columns will be maintained.

Horizontal splitting (rows)

Not supported yet

Usage

The below command will take large-file.csv and split it vertically into 3 files. First file will have 10 columns, 2nd file will have 5, and the 3rd will have 12. If there are more columns in the original file, they will be ignored.

csv-split -i ~/Downloads/large-file.csv -p 10,5,12

Instead of split-pattern, you can also specify batch size.

csv-split -i ~/Downloads/large-file.csv -b 7

By default, all the output files will be stored in a new directory called output. Generated file names will have index number appended. For example, large-file_1.csv, large-file_2.csv, ...

If you want to change the output directory, you can use -o option as shown below.

csv-split -i ~/Downloads/large-file.csv -b 10 -o ~/Downloads/splitted-data/

If this directory does not exist, it will be created.

This will create csv files and each csv file will contain 7 columns. Number of output files will depend on number of columns in input files.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csv-split-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csv_split-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file csv-split-0.1.2.tar.gz.

File metadata

  • Download URL: csv-split-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for csv-split-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b280ef280a521d0b840a3b31b585daf7c11ad50168d643ff0201f49d97ed2f96
MD5 51ee10076705bfcb61841cfcea041f55
BLAKE2b-256 1e3782860ec9e2246f9b2f2632f51c24274085d736a60bc14a2cb3beaefbf68a

See more details on using hashes here.

File details

Details for the file csv_split-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: csv_split-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for csv_split-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94c464b7ca3ba5a675f034d6d02639fc3a236eba08afa874be69fb54036861d0
MD5 84e50baff7d2ff03ea4ddcd3ed201534
BLAKE2b-256 d882c8395a6e533aab6db242ccfb756586c50709c819afc56375d703084fe181

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page