macpie.util.DataTable#
- class macpie.util.DataTable(data, axis=0, fillvalue=None)#
A list of of equal-sized lists.
- Parameters:
- axisint, Default is 0
Axis the lists belong to (as rows if axis=0, or columns if axis=1)
- fillvalueoptional, default is None
If lists are unequally sized, fill in missing values with fillvalue.
Examples
Constructing a DataTable.
>>> dt = mp.util.DataTable(data=[[1, 2], [4, 5, 6]]) >>> dt DataTable(data=[[1, 2, None], [4, 5, 6]]) >>> dt = mp.util.DataTable(data=[[1, 2, 3], [4, 5, 6]], axis=1) >>> dt DataTable(data=[[1, 4], [2, 5], [3, 6]])
Transposing the data.
>>> dt = mp.util.DataTable(data=[[1, 2, 3], [4, 5, 6]]) >>> dt.data [[1, 2, 3], [4, 5, 6]] >>> dt.transpose() >>> dt.data [[1, 4], [2, 5], [3, 6]]
- __init__(data, axis=0, fillvalue=None)#
Methods
__init__(data[, axis, fillvalue])append(item)S.append(value) -- append value to the end of the sequence
clear()copy()count(value)extend(other)S.extend(iterable) -- extend sequence by appending elements from the iterable
from_df(df)from_seqs(*seqs[, axis, fillvalue])Create from one or more sequencs.
index(value, [start, [stop]])Raises ValueError if the value is not present.
insert(i, item)S.insert(index, value) -- insert value before index
pop([index])Raise IndexError if list is empty or index is out of range.
remove(item)S.remove(value) -- remove first occurrence of value.
reverse()S.reverse() -- reverse IN PLACE
sort(*args, **kwds)transpose()Transpose the list of lists.