13. Transformations & Utilities

The following utilites transform a container into a container of similar size.

13.1. Index

Index.isin(other: Iterable[Any]) → numpy.ndarray[source]

Return a Boolean array showing True where a label is found in other. If other is a multidimensional array, it is flattened.

Index.roll(shift: int) → static_frame.core.index.Index[source]

Return an Index with values rotated forward and wrapped around (with a postive shift) or backward and wrapped around (with a negative shift).

13.2. Series

Series.astype(dtype: Union[str, numpy.dtype, type, None]) → static_frame.core.series.Series[source]

Return a Series with type determined by dtype argument. Note that for Series, this is a simple function, whereas for Frame, this is an interface exposing both a callable and a getitem interface.

Series.clip(lower=None, upper=None)[source]

Apply a clip opertion to this Series. Note that clip operations can be applied to object types, but cannot be applied to non-numerical objects (e.g., strings, None)

Parameters
  • lower – value or Series to define the inclusive lower bound.

  • upper – value or Series to define the inclusive upper bound.

Series.isin(other) → static_frame.core.series.Series[source]

Return a same-sized Boolean Series that shows if the same-positoined element is in the iterable passed to the function.

Series.transpose() → static_frame.core.series.Series[source]

The transpositon of a Series is itself.

Series.unique() → numpy.ndarray[source]

Return a NumPy array of unqiue values.

Series.duplicated(exclude_first=False, exclude_last=False) → numpy.ndarray[source]

Return a same-sized Boolean Series that shows True for all b values that are duplicated.

Series.drop_duplicated(exclude_first: bool = False, exclude_last: bool = False) → static_frame.core.series.Series[source]

Return a Series with duplicated values removed.

Series.roll(shift: int, include_index: bool = False) → static_frame.core.series.Series[source]

Return a Series with values rotated forward and wrapped around the index (with a postive shift) or backward and wrapped around the index (with a negative shift).

Parameters
  • shift – Postive or negative integer shift.

  • include_index – Determine if the Index is shifted with the underlying data.

Series.shift(shift: int, fill_value=nan) → static_frame.core.series.Series[source]

Return a Series with values shifted forward on the index (with a postive shift) or backward on the index (with a negative shift).

Parameters
  • shift – Postive or negative integer shift.

  • fill_value – Value to be used to fill data missing after the shift.

Series.head(count: int = 5) → static_frame.core.series.Series[source]

Return a Series consisting only of the top elements as specified by count.

Parameters

count – Number of elements to be returned from the top of the Series.

Series.tail(count: int = 5) → static_frame.core.series.Series[source]

Return a Series consisting only of the bottom elements as specified by count.

Parameters

count – Number of elements to be returned from the bottom of the Series.

13.3. Frame

Series.astype(dtype)

Replace the values specified by the key with values casted to the provided dtype.

Series.astype[key](dtype)

Given a column key (either a column label, list of column lables, slice of colum labels, or Boolean array), replace the values specified by the column key with values casted to the provided dtype.

Frame.clip(lower=None, upper=None, axis: Optional[int] = None)[source]

Apply a clip opertion to this Frame. Note that clip operations can be applied to object types, but cannot be applied to non-numerical objects (e.g., strings, None)

Parameters
  • lower – value, Series, Frame

  • upper – value, Series, Frame

  • axis – required if lower or upper are given as a Series.

Frame.isin(other) → static_frame.core.frame.Frame[source]

Return a same-sized Boolean Frame that shows if the same-positioned element is in the iterable passed to the function.

Frame.transpose() → static_frame.core.frame.Frame[source]

Return a tansposed version of the Frame.

Frame.unique(axis: Optional[int] = None) → numpy.ndarray[source]

Return a NumPy array of unqiue values. If the axis argument is provied, uniqueness is determined by columns or row.

Frame.duplicated(axis=0, exclude_first=False, exclude_last=False) → static_frame.core.series.Series[source]

Return an axis-sized Boolean Series that shows True for all rows (axis 0) or columns (axis 1) duplicated.

Frame.drop_duplicated(axis=0, exclude_first: bool = False, exclude_last: bool = False) → static_frame.core.frame.Frame[source]

Return a Frame with duplicated values removed.

Frame.roll(index: int = 0, columns: int = 0, include_index: bool = False, include_columns: bool = False) → static_frame.core.frame.Frame[source]
Parameters
  • include_index – Determine if index is included in index-wise rotation.

  • include_columns – Determine if column index is included in index-wise rotation.

Frame.shift(index: int = 0, columns: int = 0, fill_value=nan) → static_frame.core.frame.Frame[source]
Frame.head(count: int = 5) → static_frame.core.frame.Frame[source]

Return a Frame consisting only of the top rows as specified by count.

Frame.tail(count: int = 5) → static_frame.core.frame.Frame[source]

Return a Frame consisting only of the bottom rows as specified by count.

Deviations from Pandas

Pandas pd.DataFrame.duplicated() is equivalent to Frame.duplicated(exclude_first=True). Pandas pd.DataFrame.drop_duplicates() is equivalent to Frame.drop_duplicated(exclude_first=True).