1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
|
%global _empty_manifest_terminate_build 0
Name: python-bcolz-zipline
Version: 1.2.6
Release: 1
Summary: Columnar and compressed data containers.
License: Copyright Notice and Statement for bcolz Software Library and Utilities: Copyright (c) 2010-2011 by Francesc Alted Copyright (c) 2012 by Continuum Analytics Copyright (c) 2013 by Francesc Alted Copyright (c) 2014-2018 by Francesc Alted and the bcolz contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: a. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. b. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. c. Neither the name of Francesc Alted nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
URL: https://pypi.org/project/bcolz-zipline/
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/df/a2/8cb034b0cd58841eca00256b1e662ecd8e30397d1850203759e98cbe0148/bcolz-zipline-1.2.6.tar.gz
Requires: python3-numpy
Requires: python3-numexpr
Requires: python3-dask
Requires: python3-pandas
Requires: python3-tables
Requires: python3-pytest
Requires: python3-pytest-cov
Requires: python3-coveralls
%description
# bcolz: columnar and compressed data containers
<p align="center">
<a href="https://gitter.im/Blosc/bcolz?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" target="_blank">
<img alt="Gitter" src="https://badges.gitter.im/Blosc/bcolz.svg" />
</a>
<a href="https://pypi.org/project/bcolz-zipline/" target="_blank">
<img alt="Version" src="https://img.shields.io/pypi/v/bcolz-zipline.svg?cacheSeconds=2592000" />
</a>
<a href="https://bcolz.readthedocs.io/en/latest/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Tests?label=tests"><a href='https://coveralls.io/github/stefan-jansen/bcolz-zipline?branch=main'><img src='https://coveralls.io/repos/github/stefan-jansen/bcolz-zipline/badge.svg?branch=main' alt='Coverage Status' /></a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20Wheels?label=PyPI"><a href="#" target="_blank">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20conda%20distribution?label=Anaconda">
<img alt="License: BSD" src="https://img.shields.io/badge/License-BSD-yellow.svg" />
</a>
<a href="https://twitter.com/ml4trading" target="_blank">
<img alt="Twitter: @ml4t" src="https://img.shields.io/twitter/follow/ml4trading.svg?style=social" />
</a>
<a href="http://blosc.org" target="_blank">
<img alt="Blosc" src="http://b.repl.ca/v1/Powered--By-Blosc-blue.png" />
</a>
</p>
<p align="center">
<a href="https://www.amazon.com/Machine-Learning-Algorithmic-Trading-alternative/dp/1839217715?pf_rd_r=GZH2XZ35GB3BET09PCCA&pf_rd_p=c5b6893a-24f2-4a59-9d4b-aff5065c90ec&pd_rd_r=91a679c7-f069-4a6e-bdbb-a2b3f548f0c8&pd_rd_w=2B0Q0&pd_rd_wg=GMY5S&ref_=pd_gw_ci_mcx_mr_hp_d">
<img src="https://imgur.com/g8emkEZ.png" width="35%">
</a>
</p>
bcolz provides columnar, chunked data containers that can be compressed either in-memory and on-disk. Column storage allows for efficiently querying tables, as well as for cheap column addition and removal. It is based on [NumPy](http://www.numpy.org), and uses it as the standard data container to communicate with bcolz objects, but it also comes with support for import/export facilities to/from [HDF5/PyTables tables](http://www.pytables.org) and [pandas dataframes](http://pandas.pydata.org).
bcolz objects are compressed by default not only for reducing memory/disk storage, but also to improve I/O speed. The compression process is carried out internally by [Blosc](http://blosc.org), a high-performance, multithreaded meta-compressor that is optimized for binary data (although it works with text data just fine too).
bcolz can also use [numexpr](https://github.com/pydata/numexpr)
internally (it does that by default if it detects numexpr installed) or
[dask](https://github.com/dask/dask) so as to accelerate many vector and query operations (although it can use pure NumPy for doing so too). numexpr/dask can optimize the memory usage and use multithreading for doing the computations, so it is blazing fast. This, in combination with carray/ctable disk-based, compressed containers, can be used for performing out-of-core computations efficiently, but most importantly
*transparently*.
Just to whet your appetite, [here is an example](http://nbviewer.ipython.org/github/Blosc/movielens-bench/blob/master/querying-ep14.ipynb)
with real data, where bcolz is already fulfilling the promise of accelerating memory I/O by using compression.
## Rationale
By using compression, you can deal with more data using the same amount of memory, which is very good on itself. But in case you are wondering about the price to pay in terms of performance, you should know that nowadays memory access is the most common bottleneck in many computational scenarios, and that CPUs spend most of its time waiting for data. Hence, having data compressed in memory can reduce the stress of the memory subsystem as well.
Furthermore, columnar means that the tabular datasets are stored column-wise order, and this turns out to offer better opportunities to improve compression ratio. This is because data tends to expose more similarity in elements that sit in the same column rather than those in the same row, so compressors generally do a much better job when data is aligned in such column-wise order. In addition, when you have to deal with tables with a large number of columns and your operations only involve some
of them, a columnar-wise storage tends to be much more effective because minimizes the amount of data that travels to CPU caches.
So, the ultimate goal for bcolz is not only reducing the memory needs of large arrays/tables, but also making bcolz operations to go faster than using a traditional data container like those in NumPy or Pandas. That is actually already the case in some real-life scenarios (see the notebook above) but that will become pretty more noticeable in combination with forthcoming, faster CPUs integrating more cores and wider vector units.
## Requisites
- Python >= 3.7
- NumPy >= 1.16.5, <1.23 (1.23 is not supported yet)
- Cython >= 0.22 (just for compiling the beast)
- C-Blosc >= 1.8.0 (optional, as the internal Blosc will be used by default)
Optional:
- numexpr >= 2.5.2
- dask >= 0.9.0
- pandas
- tables (pytables)
## Installing as wheel
There are wheels for Linux and Mac OS X that you can install with
```python
pip install bcolz-zipline
```
Then also install NumPy with
and test your installation with
```python
python -c 'import bcolz;bcolz.test()'
```
## Building
There are different ways to compile bcolz, depending on whether you want to link with an already installed Blosc library or not.
### Compiling with an installed Blosc library (recommended)
Python and Blosc-powered extensions have a difficult relationship when compiled using GCC, so this is why using an external C-Blosc library is recommended for maximum performance (for details, see
<https://github.com/Blosc/python-blosc/issues/110>).
Go to <https://github.com/Blosc/c-blosc/releases> and download and install the C-Blosc library. Then, you can tell bcolz where is the C-Blosc library in a couple of ways:
Using an environment variable:
``` {.sourceCode .console}
$ BLOSC_DIR=/usr/local (or "set BLOSC_DIR=\blosc" on Win)
$ export BLOSC_DIR (not needed on Win)
$ python setup.py build_ext --inplace
```
Using a flag:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace --blosc=/usr/local
```
### Compiling without an installed Blosc library
bcolz also comes with the Blosc sources with it so, assuming that you have a C++ compiler installed, do:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace
```
That\'s all. You can proceed with testing section now.
Note: The requirement for the C++ compiler is just for the Snappy dependency. The rest of the other components of Blosc are pure C
(including the LZ4 and Zlib libraries).
## Testing
After compiling, you can quickly check that the package is sane by running:
$ PYTHONPATH=. (or "set PYTHONPATH=." on Windows)
$ export PYTHONPATH (not needed on Windows)
$ python -c "import bcolz; bcolz.test()" # add `heavy=True` if desired
## Installing
Install it as a typical Python package:
$ pip install -U .
Optionally Install the additional dependencies:
$ pip install .[optional]pip
## Documentation
You can find the online manual at:
<http://bcolz.blosc.org>
but of course, you can always access docstrings from the console (i.e.
`help(bcolz.ctable)`).
Also, you may want to look at the bench/ directory for some examples of use.
## Resources
Visit the main bcolz site repository at: <http://github.com/Blosc/bcolz>
Home of Blosc compressor: <http://blosc.org>
User\'s mail list: <http://groups.google.com/group/bcolz>
(<bcolz@googlegroups.com>)
An [introductory talk (20 min)](https://www.youtube.com/watch?v=-lKV4zC1gss) about bcolz at EuroPython
2014. [Slides here](http://blosc.org/docs/bcolz-EuroPython-2014.pdf).
## License
Please see `BCOLZ.txt` in `LICENSES/` directory.
## Share your experience
Let us know of any bugs, suggestions, gripes, kudos, etc. you may have.
**Enjoy Data!**
%package -n python3-bcolz-zipline
Summary: Columnar and compressed data containers.
Provides: python-bcolz-zipline
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: python3-cffi
BuildRequires: gcc
BuildRequires: gdb
%description -n python3-bcolz-zipline
# bcolz: columnar and compressed data containers
<p align="center">
<a href="https://gitter.im/Blosc/bcolz?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" target="_blank">
<img alt="Gitter" src="https://badges.gitter.im/Blosc/bcolz.svg" />
</a>
<a href="https://pypi.org/project/bcolz-zipline/" target="_blank">
<img alt="Version" src="https://img.shields.io/pypi/v/bcolz-zipline.svg?cacheSeconds=2592000" />
</a>
<a href="https://bcolz.readthedocs.io/en/latest/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Tests?label=tests"><a href='https://coveralls.io/github/stefan-jansen/bcolz-zipline?branch=main'><img src='https://coveralls.io/repos/github/stefan-jansen/bcolz-zipline/badge.svg?branch=main' alt='Coverage Status' /></a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20Wheels?label=PyPI"><a href="#" target="_blank">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20conda%20distribution?label=Anaconda">
<img alt="License: BSD" src="https://img.shields.io/badge/License-BSD-yellow.svg" />
</a>
<a href="https://twitter.com/ml4trading" target="_blank">
<img alt="Twitter: @ml4t" src="https://img.shields.io/twitter/follow/ml4trading.svg?style=social" />
</a>
<a href="http://blosc.org" target="_blank">
<img alt="Blosc" src="http://b.repl.ca/v1/Powered--By-Blosc-blue.png" />
</a>
</p>
<p align="center">
<a href="https://www.amazon.com/Machine-Learning-Algorithmic-Trading-alternative/dp/1839217715?pf_rd_r=GZH2XZ35GB3BET09PCCA&pf_rd_p=c5b6893a-24f2-4a59-9d4b-aff5065c90ec&pd_rd_r=91a679c7-f069-4a6e-bdbb-a2b3f548f0c8&pd_rd_w=2B0Q0&pd_rd_wg=GMY5S&ref_=pd_gw_ci_mcx_mr_hp_d">
<img src="https://imgur.com/g8emkEZ.png" width="35%">
</a>
</p>
bcolz provides columnar, chunked data containers that can be compressed either in-memory and on-disk. Column storage allows for efficiently querying tables, as well as for cheap column addition and removal. It is based on [NumPy](http://www.numpy.org), and uses it as the standard data container to communicate with bcolz objects, but it also comes with support for import/export facilities to/from [HDF5/PyTables tables](http://www.pytables.org) and [pandas dataframes](http://pandas.pydata.org).
bcolz objects are compressed by default not only for reducing memory/disk storage, but also to improve I/O speed. The compression process is carried out internally by [Blosc](http://blosc.org), a high-performance, multithreaded meta-compressor that is optimized for binary data (although it works with text data just fine too).
bcolz can also use [numexpr](https://github.com/pydata/numexpr)
internally (it does that by default if it detects numexpr installed) or
[dask](https://github.com/dask/dask) so as to accelerate many vector and query operations (although it can use pure NumPy for doing so too). numexpr/dask can optimize the memory usage and use multithreading for doing the computations, so it is blazing fast. This, in combination with carray/ctable disk-based, compressed containers, can be used for performing out-of-core computations efficiently, but most importantly
*transparently*.
Just to whet your appetite, [here is an example](http://nbviewer.ipython.org/github/Blosc/movielens-bench/blob/master/querying-ep14.ipynb)
with real data, where bcolz is already fulfilling the promise of accelerating memory I/O by using compression.
## Rationale
By using compression, you can deal with more data using the same amount of memory, which is very good on itself. But in case you are wondering about the price to pay in terms of performance, you should know that nowadays memory access is the most common bottleneck in many computational scenarios, and that CPUs spend most of its time waiting for data. Hence, having data compressed in memory can reduce the stress of the memory subsystem as well.
Furthermore, columnar means that the tabular datasets are stored column-wise order, and this turns out to offer better opportunities to improve compression ratio. This is because data tends to expose more similarity in elements that sit in the same column rather than those in the same row, so compressors generally do a much better job when data is aligned in such column-wise order. In addition, when you have to deal with tables with a large number of columns and your operations only involve some
of them, a columnar-wise storage tends to be much more effective because minimizes the amount of data that travels to CPU caches.
So, the ultimate goal for bcolz is not only reducing the memory needs of large arrays/tables, but also making bcolz operations to go faster than using a traditional data container like those in NumPy or Pandas. That is actually already the case in some real-life scenarios (see the notebook above) but that will become pretty more noticeable in combination with forthcoming, faster CPUs integrating more cores and wider vector units.
## Requisites
- Python >= 3.7
- NumPy >= 1.16.5, <1.23 (1.23 is not supported yet)
- Cython >= 0.22 (just for compiling the beast)
- C-Blosc >= 1.8.0 (optional, as the internal Blosc will be used by default)
Optional:
- numexpr >= 2.5.2
- dask >= 0.9.0
- pandas
- tables (pytables)
## Installing as wheel
There are wheels for Linux and Mac OS X that you can install with
```python
pip install bcolz-zipline
```
Then also install NumPy with
and test your installation with
```python
python -c 'import bcolz;bcolz.test()'
```
## Building
There are different ways to compile bcolz, depending on whether you want to link with an already installed Blosc library or not.
### Compiling with an installed Blosc library (recommended)
Python and Blosc-powered extensions have a difficult relationship when compiled using GCC, so this is why using an external C-Blosc library is recommended for maximum performance (for details, see
<https://github.com/Blosc/python-blosc/issues/110>).
Go to <https://github.com/Blosc/c-blosc/releases> and download and install the C-Blosc library. Then, you can tell bcolz where is the C-Blosc library in a couple of ways:
Using an environment variable:
``` {.sourceCode .console}
$ BLOSC_DIR=/usr/local (or "set BLOSC_DIR=\blosc" on Win)
$ export BLOSC_DIR (not needed on Win)
$ python setup.py build_ext --inplace
```
Using a flag:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace --blosc=/usr/local
```
### Compiling without an installed Blosc library
bcolz also comes with the Blosc sources with it so, assuming that you have a C++ compiler installed, do:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace
```
That\'s all. You can proceed with testing section now.
Note: The requirement for the C++ compiler is just for the Snappy dependency. The rest of the other components of Blosc are pure C
(including the LZ4 and Zlib libraries).
## Testing
After compiling, you can quickly check that the package is sane by running:
$ PYTHONPATH=. (or "set PYTHONPATH=." on Windows)
$ export PYTHONPATH (not needed on Windows)
$ python -c "import bcolz; bcolz.test()" # add `heavy=True` if desired
## Installing
Install it as a typical Python package:
$ pip install -U .
Optionally Install the additional dependencies:
$ pip install .[optional]pip
## Documentation
You can find the online manual at:
<http://bcolz.blosc.org>
but of course, you can always access docstrings from the console (i.e.
`help(bcolz.ctable)`).
Also, you may want to look at the bench/ directory for some examples of use.
## Resources
Visit the main bcolz site repository at: <http://github.com/Blosc/bcolz>
Home of Blosc compressor: <http://blosc.org>
User\'s mail list: <http://groups.google.com/group/bcolz>
(<bcolz@googlegroups.com>)
An [introductory talk (20 min)](https://www.youtube.com/watch?v=-lKV4zC1gss) about bcolz at EuroPython
2014. [Slides here](http://blosc.org/docs/bcolz-EuroPython-2014.pdf).
## License
Please see `BCOLZ.txt` in `LICENSES/` directory.
## Share your experience
Let us know of any bugs, suggestions, gripes, kudos, etc. you may have.
**Enjoy Data!**
%package help
Summary: Development documents and examples for bcolz-zipline
Provides: python3-bcolz-zipline-doc
%description help
# bcolz: columnar and compressed data containers
<p align="center">
<a href="https://gitter.im/Blosc/bcolz?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" target="_blank">
<img alt="Gitter" src="https://badges.gitter.im/Blosc/bcolz.svg" />
</a>
<a href="https://pypi.org/project/bcolz-zipline/" target="_blank">
<img alt="Version" src="https://img.shields.io/pypi/v/bcolz-zipline.svg?cacheSeconds=2592000" />
</a>
<a href="https://bcolz.readthedocs.io/en/latest/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Tests?label=tests"><a href='https://coveralls.io/github/stefan-jansen/bcolz-zipline?branch=main'><img src='https://coveralls.io/repos/github/stefan-jansen/bcolz-zipline/badge.svg?branch=main' alt='Coverage Status' /></a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20Wheels?label=PyPI"><a href="#" target="_blank">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/stefan-jansen/bcolz-zipline/Build%20conda%20distribution?label=Anaconda">
<img alt="License: BSD" src="https://img.shields.io/badge/License-BSD-yellow.svg" />
</a>
<a href="https://twitter.com/ml4trading" target="_blank">
<img alt="Twitter: @ml4t" src="https://img.shields.io/twitter/follow/ml4trading.svg?style=social" />
</a>
<a href="http://blosc.org" target="_blank">
<img alt="Blosc" src="http://b.repl.ca/v1/Powered--By-Blosc-blue.png" />
</a>
</p>
<p align="center">
<a href="https://www.amazon.com/Machine-Learning-Algorithmic-Trading-alternative/dp/1839217715?pf_rd_r=GZH2XZ35GB3BET09PCCA&pf_rd_p=c5b6893a-24f2-4a59-9d4b-aff5065c90ec&pd_rd_r=91a679c7-f069-4a6e-bdbb-a2b3f548f0c8&pd_rd_w=2B0Q0&pd_rd_wg=GMY5S&ref_=pd_gw_ci_mcx_mr_hp_d">
<img src="https://imgur.com/g8emkEZ.png" width="35%">
</a>
</p>
bcolz provides columnar, chunked data containers that can be compressed either in-memory and on-disk. Column storage allows for efficiently querying tables, as well as for cheap column addition and removal. It is based on [NumPy](http://www.numpy.org), and uses it as the standard data container to communicate with bcolz objects, but it also comes with support for import/export facilities to/from [HDF5/PyTables tables](http://www.pytables.org) and [pandas dataframes](http://pandas.pydata.org).
bcolz objects are compressed by default not only for reducing memory/disk storage, but also to improve I/O speed. The compression process is carried out internally by [Blosc](http://blosc.org), a high-performance, multithreaded meta-compressor that is optimized for binary data (although it works with text data just fine too).
bcolz can also use [numexpr](https://github.com/pydata/numexpr)
internally (it does that by default if it detects numexpr installed) or
[dask](https://github.com/dask/dask) so as to accelerate many vector and query operations (although it can use pure NumPy for doing so too). numexpr/dask can optimize the memory usage and use multithreading for doing the computations, so it is blazing fast. This, in combination with carray/ctable disk-based, compressed containers, can be used for performing out-of-core computations efficiently, but most importantly
*transparently*.
Just to whet your appetite, [here is an example](http://nbviewer.ipython.org/github/Blosc/movielens-bench/blob/master/querying-ep14.ipynb)
with real data, where bcolz is already fulfilling the promise of accelerating memory I/O by using compression.
## Rationale
By using compression, you can deal with more data using the same amount of memory, which is very good on itself. But in case you are wondering about the price to pay in terms of performance, you should know that nowadays memory access is the most common bottleneck in many computational scenarios, and that CPUs spend most of its time waiting for data. Hence, having data compressed in memory can reduce the stress of the memory subsystem as well.
Furthermore, columnar means that the tabular datasets are stored column-wise order, and this turns out to offer better opportunities to improve compression ratio. This is because data tends to expose more similarity in elements that sit in the same column rather than those in the same row, so compressors generally do a much better job when data is aligned in such column-wise order. In addition, when you have to deal with tables with a large number of columns and your operations only involve some
of them, a columnar-wise storage tends to be much more effective because minimizes the amount of data that travels to CPU caches.
So, the ultimate goal for bcolz is not only reducing the memory needs of large arrays/tables, but also making bcolz operations to go faster than using a traditional data container like those in NumPy or Pandas. That is actually already the case in some real-life scenarios (see the notebook above) but that will become pretty more noticeable in combination with forthcoming, faster CPUs integrating more cores and wider vector units.
## Requisites
- Python >= 3.7
- NumPy >= 1.16.5, <1.23 (1.23 is not supported yet)
- Cython >= 0.22 (just for compiling the beast)
- C-Blosc >= 1.8.0 (optional, as the internal Blosc will be used by default)
Optional:
- numexpr >= 2.5.2
- dask >= 0.9.0
- pandas
- tables (pytables)
## Installing as wheel
There are wheels for Linux and Mac OS X that you can install with
```python
pip install bcolz-zipline
```
Then also install NumPy with
and test your installation with
```python
python -c 'import bcolz;bcolz.test()'
```
## Building
There are different ways to compile bcolz, depending on whether you want to link with an already installed Blosc library or not.
### Compiling with an installed Blosc library (recommended)
Python and Blosc-powered extensions have a difficult relationship when compiled using GCC, so this is why using an external C-Blosc library is recommended for maximum performance (for details, see
<https://github.com/Blosc/python-blosc/issues/110>).
Go to <https://github.com/Blosc/c-blosc/releases> and download and install the C-Blosc library. Then, you can tell bcolz where is the C-Blosc library in a couple of ways:
Using an environment variable:
``` {.sourceCode .console}
$ BLOSC_DIR=/usr/local (or "set BLOSC_DIR=\blosc" on Win)
$ export BLOSC_DIR (not needed on Win)
$ python setup.py build_ext --inplace
```
Using a flag:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace --blosc=/usr/local
```
### Compiling without an installed Blosc library
bcolz also comes with the Blosc sources with it so, assuming that you have a C++ compiler installed, do:
``` {.sourceCode .console}
$ python setup.py build_ext --inplace
```
That\'s all. You can proceed with testing section now.
Note: The requirement for the C++ compiler is just for the Snappy dependency. The rest of the other components of Blosc are pure C
(including the LZ4 and Zlib libraries).
## Testing
After compiling, you can quickly check that the package is sane by running:
$ PYTHONPATH=. (or "set PYTHONPATH=." on Windows)
$ export PYTHONPATH (not needed on Windows)
$ python -c "import bcolz; bcolz.test()" # add `heavy=True` if desired
## Installing
Install it as a typical Python package:
$ pip install -U .
Optionally Install the additional dependencies:
$ pip install .[optional]pip
## Documentation
You can find the online manual at:
<http://bcolz.blosc.org>
but of course, you can always access docstrings from the console (i.e.
`help(bcolz.ctable)`).
Also, you may want to look at the bench/ directory for some examples of use.
## Resources
Visit the main bcolz site repository at: <http://github.com/Blosc/bcolz>
Home of Blosc compressor: <http://blosc.org>
User\'s mail list: <http://groups.google.com/group/bcolz>
(<bcolz@googlegroups.com>)
An [introductory talk (20 min)](https://www.youtube.com/watch?v=-lKV4zC1gss) about bcolz at EuroPython
2014. [Slides here](http://blosc.org/docs/bcolz-EuroPython-2014.pdf).
## License
Please see `BCOLZ.txt` in `LICENSES/` directory.
## Share your experience
Let us know of any bugs, suggestions, gripes, kudos, etc. you may have.
**Enjoy Data!**
%prep
%autosetup -n bcolz-zipline-1.2.6
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-bcolz-zipline -f filelist.lst
%dir %{python3_sitearch}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.6-1
- Package Spec generated
|