A progressbar wrapper for standart csv package
Project description
CSVProgressBar
This package provides a progress bar wrapper for the standard csv library
Usage
To use csv reader you must specify ProgressBar object
, witch must have update method:
from csv_progress_bar import read_with_pbar
pbar = MyPbar(...)
with open('my_file.csv') as csvfile:
reader = read_with_pbar(csvfile, pbar)
for row in reader:
...
When reading a csv file, the reader calls the update method of the progerss bar, where the argument is the number of readed bytes. So set the progressbar total as the file size in bytes.
Personally, I like to use tqdm:
import os
from csv_progress_bar import read_with_pbar
from tqdm import tqdm
path = 'my_file.csv'
total_size = os.path.getsize(path)
pbar = tqdm(total= total_size)
with open(path) as csvfile:
reader = read_with_pbar(csvfile, pbar)
for row in reader:
...
Performance
Unfortunately, due to frequent iterations and additional function calls, reading is **~ 30% slower**
Cooming soon
- readers objecs for pupular progressbars
- progressbar for pandas reader!
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
csv_progressbar-0.1.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for csv_progressbar-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 568c6470c297e42c84e3e78bd1439c4b4e2c8f0600e0e631bfe0482afb7fca61 |
|
MD5 | 22a278e26ba5e0696c71eb6686993575 |
|
BLAKE2b-256 | 0871714b2cbb56c30b17aa84c762e1f2823652e641f1cd028c2823221aa66a11 |