Convert file format with pandas
Project description
convert-fileformat-with-pandas
Convert file format with pandas.
Requirements
- Python 3.7+
Install
$ pip install convpandas
https://pypi.org/project/convpandas/
Usage
csv2xlsx
Convert csv file to xlsx file.
$ convpandas csv2xlsx --help
Usage: convpandas csv2xlsx [OPTIONS] [CSV_FILE]... XLSX_FILE
Convert csv file to xlsx file.
Options:
--sep TEXT Delimiter to use when reading csv. [default:,]
--encoding TEXT Encoding to use when reading csv. List of Python standard encodings. (https://docs.python.org/3/library/codecs.html#standard-encodings) [default: utf-8]
--quotechar TEXT The character used to denote the start and end of a quoted item when reading csv.
--string_to_numeric BOOLEAN If true, convert string to numeric. [default:true]
Convert in.csv
to out.xlsx
.
$ convpandas csv2xlsx in.csv out.xlsx
When specifying -
for CSV_FILE
, get from STDIN.
$ convpandas csv2xlsx - out.xlsx < in.csv
Convert in1.csv
and in2.csv
to out.xlsx
. Sheet name is csv filename without its suffix.
$ convpandas csv2xlsx in1.csv in2.csv out.xlsx
xlsx2csv
Convert xlsx file to csv file.
$ convpandas xlsx2csv --help
Usage: convpandas xlsx2csv [OPTIONS] XLSX_FILE CSV_FILE
Convert xlsx file to csv file.
Options:
--sheet_name TEXT Sheet name when reading xlsx. If not specified, read 1st sheet.
--sep TEXT Field delimiter for the output file. [default: ,]
--encoding TEXT A string representing the encoding to use in the output file. [default: utf-8]
--quotechar TEXT Character used to quote fields.
--help Show this message and exit.
Convert in.xlsx
to out.csv
.
$ convpandas csv2xlsx in.xlsx out.csv
When specifying -
for CSV_FILE
, write to STDOUT.
$ convpandas csv2xlsx in.xlsx -
name,age
Alice,23
With specifying --sheet_name
, you can select sheet name that you want to convert.
$ convpandas csv2xlsx in.xlsx out.csv --sheet_name sheet2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
convpandas-0.2.0.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for convpandas-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee2d5db78f71e24526e04e7d34a3d2e9bc082e1e37012a48e0b725ae07743f61 |
|
MD5 | 016b5c190af9cf5f6121e63ee914b1f3 |
|
BLAKE2b-256 | 19310f8dfb9a8d6315df732ba8e415db1b205b34edc13af3bcb4fd71c0e6b330 |