You are viewing documentation about an older version (1.21.0). View latest version

modin.pandas.Series¶

class modin.pandas.Series(data=None, index=None, dtype=None, name=None, copy=False, fastpath=False, query_compiler=None)[source]¶

Bases: BasePandasDataset

Snowpark pandas representation of pandas.Series with a lazily-evaluated relational dataset.

A Series is considered lazy because it encapsulates the computation or query required to produce the final dataset. The computation is not performed until the datasets need to be displayed, or i/o methods like to_pandas, to_snowflake are called.

Internally, the underlying data are stored as Snowflake table with rows and columns.

Parameters:
  • data (modin.pandas.Series, array-like, Iterable, dict, or scalar value, optional) – Contains data stored in Series. If data is a dict, argument order is maintained.

  • index (array-like or Index (1d), optional) – Values must be hashable and have the same length as data.

  • dtype (str, np.dtype, or pandas.ExtensionDtype, optional) – Data type for the output Series. If not specified, this will be inferred from data.

  • name (str, optional) – The name to give to the Series.

  • copy (bool, default: False) – Copy input data.

  • fastpath (bool, default: False) – pandas internal parameter.

  • query_compiler (BaseQueryCompiler, optional) – A query compiler object to create the Series from.

Examples

Constructing Series from a dictionary with an Index specified

>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> ser = pd.Series(data=d, index=['a', 'b', 'c'])
>>> ser
a    1
b    2
c    3
dtype: int64
Copy

The keys of the dictionary match with the Index values, hence the Index values have no effect.

>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> ser = pd.Series(data=d, index=['x', 'y', 'z'])
>>> ser
x   NaN
y   NaN
z   NaN
dtype: float64
Copy

Methods

abs()

Return a Series with absolute numeric value of each element.

add(other[, level, fill_value, axis])

Return Addition of series and other, element-wise (binary operator add).

add_prefix(prefix)

Prefix labels with string prefix.

add_suffix(suffix)

Suffix labels with string suffix.

agg([func, axis])

Aggregate using one or more operations over the specified axis.

aggregate([func, axis])

Aggregate using one or more operations over the specified axis.

apply(func[, convert_dtype, args])

Invoke function on values of Series.

argmax([axis, skipna])

Return int position of the largest value in the Series.

argmin([axis, skipna])

Return int position of the smallest value in the Series.

argsort([axis, kind, order])

Return the integer indices that would sort the Series values.

autocorr([lag])

Compute the lag-N autocorrelation.

between(left, right[, inclusive])

Return boolean Series equivalent to left <= series <= right.

cache_result([inplace])

Persists the current Snowpark pandas Series to a temporary table to improve the latency of subsequent operations.

case_when(caselist)

Replace values where the conditions are True.

compare(other[, align_axis, keep_shape, ...])

Compare to another Series and show the differences.

corr(other[, method, min_periods])

Compute correlation with other Series, excluding missing values.

count()

Return number of non-NA/null observations in the Series.

cov(other[, min_periods, ddof])

Compute covariance with Series, excluding missing values.

describe([percentiles, include, exclude])

Generate descriptive statistics.

diff([periods])

First discrete difference of element.

div(other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator truediv).

divide(other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator truediv).

divmod(other[, level, fill_value, axis])

Return Integer division and modulo of series and other, element-wise (binary operator divmod).

dot(other)

Compute the dot product between the Series and the columns of other.

drop([labels, axis, index, columns, level, ...])

Return Series with specified index labels removed.

drop_duplicates([keep, inplace])

Return Series with duplicate values removed.

dropna(*[, axis, inplace, how])

Return a new Series with missing values removed.

duplicated([keep])

Indicate duplicate Series values.

eq(other[, level, fill_value, axis])

Return Equal to of series and other, element-wise (binary operator eq).

equals(other)

Test whether two series contain the same elements.

explode([ignore_index])

Transform each element of a list-like to a row.

factorize([sort, na_sentinel, use_na_sentinel])

Encode the object as an enumerated type or categorical variable.

fillna([value, method, axis, inplace, ...])

Fill NA/NaN values using the specified method.

floordiv(other[, level, fill_value, axis])

Return Integer division of series and other, element-wise (binary operator floordiv).

ge(other[, level, fill_value, axis])

Return Greater than or equal to of series and other, element-wise (binary operator ge).

groupby([by, axis, level, as_index, sort, ...])

Group Series using a mapper or by a Series of columns.

gt(other[, level, fill_value, axis])

Return Greater than of series and other, element-wise (binary operator gt).

hist([by, ax, grid, xlabelsize, xrot, ...])

Draw histogram of the input series using matplotlib.

idxmax([axis, skipna])

Return the row label of the maximum value.

idxmin([axis, skipna])

Return the row label of the minimum value.

info([verbose, buf, max_cols, memory_usage, ...])

interpolate([method, axis, limit, inplace, ...])

Fill NaN values using an interpolation method.

isin(values)

Whether elements in Series are contained in values.

isna()

Detect missing values.

isnull()

Series.isnull is an alias for Series.isna.

item()

Return the first element of the underlying data as a Python scalar.

items()

Lazily iterate over (index, value) tuples.

keys()

Return alias for index.

kurt([axis, skipna, numeric_only])

Return unbiased kurtosis over requested axis.

kurtosis([axis, skipna, numeric_only])

Return unbiased kurtosis over requested axis.

le(other[, level, fill_value, axis])

Return Less than or equal to of series and other, element-wise (binary operator le).

lt(other[, level, fill_value, axis])

Return Less than of series and other, element-wise (binary operator lt).

map(arg[, na_action])

Map values of Series according to an input mapping or function.

mask(cond[, other, inplace, axis, level])

Replace values where the condition is True.

memory_usage([index, deep])

Return the memory usage of the Series.

mod(other[, level, fill_value, axis])

Return Modulo of series and other, element-wise (binary operator mod).

mode([dropna])

Return the mode(s) of the Series.

mul(other[, level, fill_value, axis])

Return Multiplication of series and other, element-wise (binary operator mul).

multiply(other[, level, fill_value, axis])

Return Multiplication of series and other, element-wise (binary operator mul).

ne(other[, level, fill_value, axis])

Return Not equal to of series and other, element-wise (binary operator ne).

nlargest([n, keep])

Return the largest n elements.

nsmallest([n, keep])

Return the smallest n elements.

nunique([dropna])

Return number of unique elements in the series.

pow(other[, level, fill_value, axis])

Return Exponential power of series and other, element-wise (binary operator pow).

prod([axis, skipna, level, numeric_only, ...])

product([axis, skipna, level, numeric_only, ...])

quantile([q, interpolation])

Return value at the given quantile.

radd(other[, level, fill_value, axis])

Return Addition of series and other, element-wise (binary operator radd).

ravel([order])

Return the flattened underlying data as an ndarray.

rdiv(other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator rtruediv).

rdivmod(other[, level, fill_value, axis])

Return integer division and modulo of series and other, element-wise (binary operator rdivmod).

reindex(*args, **kwargs)

Conform Series to new index with optional filling logic.

rename([index, axis, copy, inplace, level, ...])

Alter Series index labels or name.

rename_axis([mapper, index, axis, copy, inplace])

Set the name of the axis for the index or columns.

reorder_levels(order)

Rearrange index levels using input order.

repeat(repeats[, axis])

Repeat elements of a Series.

replace([to_replace, value, inplace, limit, ...])

Replace values given in to_replace with value.

reset_index([level, drop, name, inplace, ...])

Generate a new DataFrame or Series with the index reset.

rfloordiv(other[, level, fill_value, axis])

Return Integer division of series and other, element-wise (binary operator rfloordiv).

rmod(other[, level, fill_value, axis])

Return Modulo of series and other, element-wise (binary operator rmod).

rmul(other[, level, fill_value, axis])

Return Multiplication of series and other, element-wise (binary operator rmul).

round([decimals])

Round each value in a Series to the given number of decimals.

rpow(other[, level, fill_value, axis])

Return Exponential power of series and other, element-wise (binary operator rpow).

rsub(other[, level, fill_value, axis])

Return Subtraction of series and other, element-wise (binary operator rsub).

rtruediv(other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator rtruediv).

searchsorted(value[, side, sorter])

Find indices where elements should be inserted to maintain order.

set_axis(labels, *[, axis, copy])

Assign desired index to given axis.

shift([periods, freq, axis, fill_value, suffix])

Shift data by desired number of periods and replace columns with fill_value (default: None).

sort_values([axis, ascending, inplace, ...])

Sort by the values.

squeeze([axis])

Squeeze 1 dimensional axis objects into scalars.

sub(other[, level, fill_value, axis])

Return Subtraction of series and other, element-wise (binary operator sub).

subtract(other[, level, fill_value, axis])

Return Subtraction of series and other, element-wise (binary operator sub).

swaplevel([i, j, copy])

Swap levels i and j in a MultiIndex.

take(indices[, axis])

Return the elements in the given positional indices along an axis.

to_dict([into])

Convert Series to {label -> value} dict or dict-like object.

to_frame([name])

Convert Series to {label -> value} dict or dict-like object.

to_list()

Return a list of the values.

to_numpy([dtype, copy, na_value])

A NumPy ndarray representing the values in this Series or Index.

to_pandas(*[, statement_params])

Convert Snowpark pandas Series to pandas.Series

to_period([freq, copy])

Cast to PeriodArray/Index at a particular frequency.

to_snowflake(name[, if_exists, index, ...])

Save the Snowpark pandas Series as a Snowflake table.

to_snowpark([index, index_label])

Convert the Snowpark pandas Series to a Snowpark DataFrame.

to_string([buf, na_rep, float_format, ...])

Render a string representation of the Series.

to_timestamp([freq, how, copy])

Cast to DatetimeIndex of Timestamps, at beginning of period.

tolist()

Return a list of the values.

transpose(*args, **kwargs)

Return the transpose, which is by definition self.

truediv(other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator truediv).

truncate([before, after, axis, copy])

Truncate a Series before and after some index value.

unique()

Return unique values of Series object.

unstack([level, fill_value, sort])

Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.

update(other)

Modify Series in place using values from passed Series.

value_counts([normalize, sort, ascending, ...])

Return a Series containing counts of unique values.

view([dtype])

Create a new view of the Series.

where(cond[, other, inplace, axis, level])

Replace values where the condition is False.

xs(key[, axis, level, drop_level])

Return cross-section from the Series/DataFrame.

Attributes

T

Return the transpose, which is by definition self.

array

Return the ExtensionArray of the data backing this Series or Index.

attrs

Return dictionary of global attributes of this dataset.

axes

Return a list of the row axis labels.

cat

Accessor object for categorical properties of the Series values.

dtype

Return the dtype object of the underlying data.

dtypes

Return the dtype object of the underlying data.

empty

Indicator whether the Series is empty.

hasnans

Return True if there are any NaNs.

is_monotonic_decreasing

Return True if values in the Series are monotonic_decreasing.

is_monotonic_increasing

Return True if values in the Series are monotonic_increasing.

is_unique

Return True if values in the Series are unique.

name

Return the name of the Series.

nbytes

Return the number of bytes in the underlying data.

ndim

Number of dimensions of the underlying data, by definition 1.

plot

Make plot of Series.

shape

Return a tuple of the shape of the underlying data.