Raccoon is a lightweight DataFrame and Series implementation inspired by the phenomenal Pandas package for the one use case where Pandas is known to be sub-optimal: DataFrames and Series that grow in size by rows frequently in the code. A simple speed comparison is below in the contents.
Pandas DataFrames and Series are excellent multi-purpose data structures for data management and analysis. One of the use cases I had was to use DataFrames as a type of in-memory database table. The issue was that this required lots of growing the rows of the DataFrame, something that is known to be slow in Pandas. The reason it is slow in Pandas is that the underlying data structure is numpy which does a complete copy of the data when the size of the array grows.
Raccoon implements what is needed to use the DataFrame as an in memory store of index and column data structure supporting simple and tuple indexes to mimic the hierarchical indexes of Pandas. The methods included are primarily about setting values of the data frame, growing and appending the data frame and getting values from the data frame. The raccoon DataFrame is not intended for math operations like pandas and only limited basic math methods are included.
Underlying Data Structure¶
Raccoon uses the standard built in lists. There is an option on object construction to use fast blist http://stutzbachenterprises.com/blist/ list replacement for the underlying data structure.
According to wikipedia some scientists believe the panda is related to the raccoon
This package serves the needs it was originally created for. Any future additions by myself will be driven by my own needs, but it is completely open source to I encourage anyone to add on and expand.
My hope is that one day Pandas solves the speed problem with growing DataFrames and this package becomes obsolete.
Raccoon required Python 2.7 or 3.3 or greater to run because it utilizes “yield from” which was introduced in 3.3
There is helper function to generate these docs from the source code. On windows cd into the docs directory and execute make_docs.bat from the command line. To run the test coverage report run the coverage.sh script.
- raccoon package
- Example Usage for DataFrame
- Example Usage for Series
- Convert to and from Pandas DataFrames
- Raccoon vs. Pandas speed test