Read multiple csvs or Excel files as a single pandas DataFrame.
Project description
pandas_multi
============
Simple loop for reading multiple csv files (matching a certain pattern) as a
``pandas.DataFrame``.
I'm aware this need can be solved in even one line of Python, but loading
multiple similar csv's is just something that should be as easy as loading
one csv. If you don't want to add a new dependency to your project, google
what ``os.listdir`` and ``glob`` can do for you.
Installation can be done by typing::
pip install pandas_multi
Usage of ``pandas_multi.read_csvs`` has been kept as similar as possible to
``pandas.read_csv``::
import pandas_multi
# <sarcasm>
# Note that dataframes only work if you give them the non-descriptive name df
# </sarcasm>
df = pandas_multi.read_csvs('./20180728*.csv')
# if you provide it with a path to a folder and nothing else, it will assume
# everything in the folder is a comma-separated file
df = pandas_multi.read_csvs('./data/')
# if this is not the case, do this:
df = pandas_multi.read_csvs('./data/*.csv')
All options that are available to ``pandas.read_csv`` or ``pandas.concat``
can be passed into ``pandas_multi.read_csvs`` and will be redirected to the
appropriate underlying functions.
If you wish to maintain a trace back to the original data, you can run the
function with the keyword argument ``filenames_as_keys=True``. Note that you
should no longer use the keyword argument ``keys``. This will be ignored.
Please note that the API for concatenation of Excel sheets is not yet stable.
============
Simple loop for reading multiple csv files (matching a certain pattern) as a
``pandas.DataFrame``.
I'm aware this need can be solved in even one line of Python, but loading
multiple similar csv's is just something that should be as easy as loading
one csv. If you don't want to add a new dependency to your project, google
what ``os.listdir`` and ``glob`` can do for you.
Installation can be done by typing::
pip install pandas_multi
Usage of ``pandas_multi.read_csvs`` has been kept as similar as possible to
``pandas.read_csv``::
import pandas_multi
# <sarcasm>
# Note that dataframes only work if you give them the non-descriptive name df
# </sarcasm>
df = pandas_multi.read_csvs('./20180728*.csv')
# if you provide it with a path to a folder and nothing else, it will assume
# everything in the folder is a comma-separated file
df = pandas_multi.read_csvs('./data/')
# if this is not the case, do this:
df = pandas_multi.read_csvs('./data/*.csv')
All options that are available to ``pandas.read_csv`` or ``pandas.concat``
can be passed into ``pandas_multi.read_csvs`` and will be redirected to the
appropriate underlying functions.
If you wish to maintain a trace back to the original data, you can run the
function with the keyword argument ``filenames_as_keys=True``. Note that you
should no longer use the keyword argument ``keys``. This will be ignored.
Please note that the API for concatenation of Excel sheets is not yet stable.
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
Built Distribution
File details
Details for the file pandas_multi-2019.3.12.tar.gz
.
File metadata
- Download URL: pandas_multi-2019.3.12.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba6feacb28c44d84c31083ac8ebb9ee378a8dbfe8e6c7a69ec31e6a213615d8 |
|
MD5 | d90d4ef05e6f60404111834804735ceb |
|
BLAKE2b-256 | 5611ceff4d13d68614acceb896fd7eeccde294347319a4ffeb71845cd48520e3 |
File details
Details for the file pandas_multi-2019.3.12-py3-none-any.whl
.
File metadata
- Download URL: pandas_multi-2019.3.12-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1745cd0801e521a54f1eefe0b22bd71bfd4175bb050660391e8f0b7d84d2053 |
|
MD5 | 73b26a2f11bd80ceb4ed0df1925df77f |
|
BLAKE2b-256 | 0fcf93f52f25a5b75a34433af237c503c816e8fcb9ccd8bd9111805a918698f3 |