spiketools.stats.anova.create_dataframe

spiketools.stats.anova.create_dataframe(data, columns=None, dropna=True, dtypes=None)[source]

Create a dataframe from an array of data.

Parameters:
datadict or 2d array

Data to organize into a dataframe. If dict, each key, value pairing should be a label and data array. If array, then should be organized as [n_observations, n_features].

columnslist of str, optional

The column labels for the dataframe. To be used if data is an array.

dropnabool, optional, default: True

Whether to drop NaN values from the dataframe.

dtypesdict, optional

Data types to typecast columns to. Each key should be a column label, and each associated value the type to typecast to.

Returns:
dfpd.DataFrame

Constructed dataframe.

Examples

Create a dataframe from arrays representing 3 trials of firing rate across 3 spatial bins:

>>> data = np.array([[1.5, 1.7, 1.9], [1.4, 1.2, 1.6], [1.5, 0.9, 0.8]])
>>> df = create_dataframe(data)