Example Usage for Drop-in List Replacements¶
# remove comment to use latest development version
import sys; sys.path.insert(0, '../')
# import libraries
import raccoon as rc
BList¶
The underlying data structure can be any drop-in replacement for list, in this example blist is used.
from blist import blist
# Construct with blist
df_blist = rc.DataFrame({'a': [1, 2, 3]}, index=[5, 6, 7], dropin=blist)
# see that the data structures are all blists
df_blist.data
blist([blist([1, 2, 3])])
df_blist.index
blist([5, 6, 7])
df_blist.columns
blist(['a'])
# the dropin class
df_blist.dropin
blist.blist
All the standard functionality works exactly the same
df_blist[6, 'a']
2
df_blist[8, 'b'] = 44
print(df_blist)
index a b
------- --- ---
5 1
6 2
7 3
8 44
Works for Series as well
# Construct with blist=True, the default
srs_blist = rc.Series([1, 2, 3], index=[5, 6, 7], dropin=blist)
# see that the data structures are all blists
srs_blist.data
blist([1, 2, 3])
srs_blist.index
blist([5, 6, 7])