GithubHelp home page GithubHelp logo

csv-splitter's Introduction

CSV File Splitter

A Python script to split large CSV files into smaller files with a specified number of rows. This tool is useful for managing large datasets and breaking them into more manageable pieces.

Features

  • Handles filenames with or without .csv extension: Automatically appends .csv if missing.
  • Customizable row limit: Specify the number of rows per split file.
  • Header inclusion: Ensures headers are included in all split files.
  • Dynamic output naming: Output files are named with the original row number range they contain, making it easy to track the data.

Usage

  1. Clone the repository:

    git clone https://github.com/sd416/csv-splitter.git
    cd csv-splitter
  2. Run the script:

    python split_csv.py -f my_data.csv -n 100 -d /path/to/output
  3. arguments:

  • -f FILENAME, --filename FILENAME

    • Name of the input CSV file. The .csv extension is optional.
  • -n NUM_ROWS, --num_rows NUM_ROWS

    • Number of rows to include in each split file.
  • -d DESTINATION, --destination DESTINATION

    • Directory path where the split files will be saved. Defaults to the current directory.

Example

    python split_csv.py -f my_data.csv -n 100 -d /path/to/output

The output files will be named:

my_data_1-100.csv
my_data_201-300.csv
.
.
.
.
my_data_501-1000.csv

...

csv-splitter's People

Contributors

sd416 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.