vice.dataframe

The VICE Dataframe: base class

Provides a means of storing and accessing data with both case-insensitive strings and integers, allowing both indexing and calling.

Signature: vice.dataframe(frame)

Parameters

framedict

A python dictionary to construct the dataframe from. Keys must all be of type str.

Raises

  • TypeError
    • frame has a key that is not of type str

Allowed Data Types

  • Keys
    • str [case-insensitive]column label

      A label given to the stored quantity (or list/array thereof).

  • Values
    • All

Indexing

  • str [case-insensitive]column label

    A label given to the quantities stored.

  • intindex for values which are array-like.

    If all values stored by the dataframe are array-like, the i’th value of all of them can be obtained by indexing the dataframe with i.

Calling

The VICE dataframe and all subclasses can be called rather than indexed to achieve the same result.

Functions

  • keys

  • todict

  • remove

  • filter

Example Code

>>> import vice
>>> example = vice.dataframe({
        "a": [1, 2, 3],
        "b": [4, 5, 6],
        "c": [7, 8, 9]})
>>> example["A"]
[1, 2, 3]
>>> example("a")
[1, 2, 3]
>>> example[0]
vice.dataframe{
        a --------------> 1
        b --------------> 4
        c --------------> 7
}
>>> example.keys()
['a', 'b', 'c']
>>> example.todict()
{'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]}
>>> example.filter("c", "<", 9)
vice.dataframe{
        a --------------> [1, 2]
        b --------------> [4, 5]
        c --------------> [7, 8]
}