Series module¶
One-dimensional labeled array capable of holding any data type.
Parameters¶
- valuesnp.ndarray
The array holding the data.
- indexIndex
The index (axis labels).
- namestr, optional
The name of the Series.
- index_typeIndexType, optional
The type of index.
Attributes¶
- referencestr
A reference code for the Series.
- namestr or None
The name of the Series.
- Sloth.Series.astype()¶
Cast the values of the frame to the specified type.
- Parameters:
- type_type
Type to cast the values to.
Examples
>>> frame.astype(float)
- Sloth.Series.iterrows()¶
Iterate over the rows of the frame.
- Yields:
- np.ndarray
Numpy array representing a row of the frame.
Examples
>>> for row in frame.iterrows(): ... print(row) [1, 2, 3] [4, 5, 6]
- Sloth.Series.plot()¶
Plotting function. Requires matplotlib and Pandas to be installed. All parameters are passed onto pandas.
- Returns:
- matplotlib.axes.AxesSubplot
AxesSubplot object representing the plot.
- Sloth.Series.resample()¶
Resample the frame to a specified frequency.
- Parameters:
- freqstr
Frequency string.
- Returns:
- Resampler
Resampler object for resampling the frame.
Examples
>>> frame.resample('D')
- Sloth.Series.rolling()¶
Provide rolling window calculations.
- Parameters:
- windowint
Size of the moving window.
- Returns:
- Rolling
Rolling object for performing rolling window calculations.
Examples
>>> frame.rolling(3)
- Sloth.Series.to_numpy()¶
Convert the frame to a numpy array.
- Returns:
- np.ndarray
Numpy array representation of the frame.
Examples
>>> frame.to_numpy() array([[1, 2, 3], [4, 5, 6]])
- Sloth.Series.to_pandas()¶
Convert the Series to a pandas Series.
- Returns:
- pd.Series
A pandas Series containing the same data.