Collection#

class grove.Collection(data_sources=None)#

A container class to manage DataFrames. Each DataFrame is stored with a string name and is accessible via indexing or attribute name.

Example

>>> import pandas as pd
>>> import grove
>>> df = pd.read_csv('c.csv')
>>>
>>> data = grove.Collection({'A':  'a.csv',
...                          'B': 'b.tsv',
...                          'C': df})
>>> data['D'] = 'd.tsv'
>>> data['A']
>>> data.B
>>> data.C

Note

For attribute access, the Collection class attribute names (e.g. show_schema) take precedence and will be returned instead.

Constructor#

__init__([data_sources])

One can create an empty collection and add DataFrames iteratively, or initialize from a list / dictionary specifying DataFrames and names.

Methods#

head([n])

Iteratively print head() for all DataFrames in the Collection.

info([memory_usage, verbose])

Print information about the collection.

merge(df_name_list[, on])

Merge multiple DataFrames in the Collection (as an inner join).

reduce_mem([target_float])

Minimize the Collection memory usage, by using the smallest applicable Numpy datatypes for all integer and float columns, in all included DataFrames.

sanity_checks()

Iteratively check for typical desirable data properties for all Collection DataFrames.

Attributes#

dataframe_list

Get the sorted list of DataFrame names in the Collection.

All members#