Series¶

All supported Series APIs

Constructor

Series([data, index, dtype, name, copy, ...])

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

Attributes

Series.index

Get the index for this Series/DataFrame.

Series.axes

Return a list of the row axis labels.

Series.array()

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

Series.dtype

Return the dtype object of the underlying data.

Series.dtypes

Return the dtype object of the underlying data.

Series.duplicated([keep])

Indicate duplicate Series values.

Series.equals(other)

Test whether two series contain the same elements.

Series.empty

Indicator whether the Series is empty.

Series.hasnans

Return True if there are any NaNs.

Series.is_monotonic_increasing

Return boolean if values in the object are monotonically increasing.

Series.is_monotonic_decreasing

Return boolean if values in the object are monotonically decreasing.

Series.name

Return the name of the Series.

Series.ndim

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

Series.shape

Return a tuple of the shape of the underlying data.

Series.size

Return an int representing the number of elements in this object.

Series.T

Return the transpose, which is by definition self.

Series.values

Return a NumPy representation of the dataset.

Snowflake Specific

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

Save the Snowpark pandas Series as a Snowflake table.

Series.to_snowpark([index, index_label])

Convert the Snowpark pandas Series to a Snowpark DataFrame.

Series.cache_result([inplace])

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

Conversion

Series.astype(dtype[, copy, errors])

Cast a pandas object to a specified dtype dtype.

Series.convert_dtypes([infer_objects, ...])

Convert columns to best possible dtypes using dtypes supporting pd.NA.

Series.copy([deep])

Make a copy of this object's indices and data.

Series.to_dict([into])

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

Series.to_list()

Return a list of the values.

Series.to_numpy([dtype, copy, na_value])

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

Series.to_pandas(*[, statement_params])

Convert Snowpark pandas Series to pandas.Series

Series.__array__([dtype])

Return the values as a NumPy array.

Indexing, iteration

Series.iloc

Purely integer-location based indexing for selection by position.

Series.items()

Lazily iterate over (index, value) tuples.

Series.loc

Access a group of rows and columns by label(s) or a boolean array.

Series.__iter__()

Return an iterator of the values.

Series.keys()

Return alias for index.

Binary operator functions

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

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

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

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

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

Get multiplication of BasePandasDataset and other, element-wise (binary operator mul).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Series.rfloordiv(other[, level, fill_value, ...])

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

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

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

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

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

Series.round([decimals])

Round a BasePandasDataset to a variable number of decimal places.

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

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

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

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

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

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

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

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

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

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

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

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

Function application, GroupBy & window

Series.apply(func[, convert_dtype, args])

Invoke function on values of Series.

Series.agg([func, axis])

Aggregate using one or more operations over the specified axis.

Series.aggregate([func, axis])

Aggregate using one or more operations over the specified axis.

Series.transform(func[, axis])

Call func on self producing a BasePandasDataset with the same axis shape as self.

Series.map(arg[, na_action])

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

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

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

Series.rolling(window[, min_periods, ...])

Provide rolling window calculations.

Computations / descriptive stats

Series.abs()

Return a BasePandasDataset with absolute numeric value of each element.

Series.all([axis, bool_only, skipna])

Return whether all elements are True, potentially over an axis.

Series.any(*[, axis, bool_only, skipna])

Return whether any element are True, potentially over an axis.

Series.count()

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

Series.cummax([axis, skipna])

Return cumulative maximum over a BasePandasDataset axis.

Series.cummin([axis, skipna])

Return cumulative minimum over a BasePandasDataset axis.

Series.cumsum([axis, skipna])

Return cumulative sum over a BasePandasDataset axis.

Series.describe([percentiles, include, exclude])

Generate descriptive statistics.

Series.diff([periods])

First discrete difference of element.

Series.max([axis, skipna, numeric_only])

Return the maximum of the values over the requested axis.

Series.mean([axis, skipna, numeric_only])

Return the mean of the values over the requested axis.

Series.median([axis, skipna, numeric_only])

Return the median of the values over the requested axis.

Series.min([axis, skipna, numeric_only])

Return the minimum of the values over the requested axis.

Series.pct_change([periods, fill_method, ...])

Fractional change between the current and a prior element.

Series.quantile([q, interpolation])

Return value at the given quantile.

Series.rank([axis, method, numeric_only, ...])

Compute numerical data ranks (1 through n) along axis.

Series.skew([axis, skipna, numeric_only])

Return unbiased skew, normalized over n-1

Series.std([axis, skipna, ddof, numeric_only])

Return sample standard deviation over requested axis.

Series.sum([axis, skipna, numeric_only, ...])

Return the sum of the values over the requested axis.

Series.var([axis, skipna, ddof, numeric_only])

Return unbiased variance over requested axis.

Series.unique()

Return unique values of Series object.

Series.nunique([dropna])

Return number of unique elements in the series.

Series.is_unique

Return True if values in the Series are unique.

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

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

Series.case_when(caselist)

Replace values where the conditions are True.

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

Return Series with specified index labels removed.

Series.drop_duplicates(*[, keep, inplace, ...])

Return Series with duplicate values removed.

Series.get(key[, default])

Get item from object for given key (ex: DataFrame column).

Series.head([n])

Return the first n rows.

Series.idxmax([axis, skipna])

Return the row label of the maximum value.

Series.idxmin([axis, skipna])

Return the row label of the minimum value.

Series.isin(values)

Whether elements in BasePandasDataset are contained in values.

Series.last(offset)

Select final periods of time series data based on a date offset.

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

Alter Series index labels or name.

Series.rename_axis([mapper, index, axis, ...])

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

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

Generate a new DataFrame or Series with the index reset.

Series.sample([n, frac, replace, weights, ...])

Return a random sample of items from an axis of object.

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

Assign desired index to given axis.

Series.take(indices[, axis])

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

Series.tail([n])

Return the last n rows.

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

Replace values where the condition is False.

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

Replace values where the condition is True.

Series.add_prefix(prefix[, axis])

Prefix labels with string prefix.

Series.add_suffix(suffix[, axis])

Suffix labels with string suffix.

Missing data handling

Series.backfill(*[, axis, inplace, limit, ...])

Synonym for DataFrame.fillna with method='bfill'.

Series.bfill(*[, axis, inplace, limit, ...])

Synonym for DataFrame.fillna with method='bfill'.

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

Return a new Series with missing values removed.

Series.ffill(*[, axis, inplace, limit, ...])

Synonym for DataFrame.fillna() with method='ffill'.

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

Fill NA/NaN values using the specified method.

Series.isna()

Detect missing values.

Series.isnull()

Series.isnull is an alias for Series.isna.

Series.notna()

Detect non-missing values for an array-like object.

Series.notnull()

Detect non-missing values for an array-like object.

Series.pad(*[, axis, inplace, limit, downcast])

Synonym for DataFrame.fillna() with method='ffill'.

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

Replace values given in to_replace with value.

Reshaping, sorting

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

Sort by the values.

Series.sort_index(*[, axis, level, ...])

Sort object by labels (along an axis).

Series.unstack([level, fill_value, sort])

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

Series.nlargest([n, keep])

Return the largest n elements.

Series.nsmallest([n, keep])

Return the smallest n elements.

Series.squeeze([axis])

Squeeze 1 dimensional axis objects into scalars.

Combining / comparing / joining / merging

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

Compare to another Series and show the differences.

Series.update(other)

Modify Series in place using values from passed Series.

Time Series-related

Series.shift([periods, freq, axis, ...])

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

Series.first_valid_index()

Return index for first non-NA value or None, if no non-NA value is found.

Series.last_valid_index()

Return index for last non-NA value or None, if no non-NA value is found.

Series.resample(rule[, axis, closed, label, ...])

Resample time-series data.

Accessors

Series.str

alias of StringMethods

Series.dt

alias of DatetimeProperties

Datetime accessor properties

All supported Series dt APIs

Series.dt.date

Returns a series of python datetime.date objects.

Series.dt.time

Returns numpy array of datetime.time objects.

Series.dt.year

Returns a series of the years of the datetime.

Series.dt.month

Returns a series of the months of the datetime.

Series.dt.day

Returns a series of the days of the datetime.

Series.dt.hour

Returns a series of the hours of the datetime.

Series.dt.minute

Returns a series of the minutes of the datetime.

Series.dt.second

Returns a series of the seconds of the datetime.

Series.dt.microsecond

The microseconds of the datetime.

Series.dt.nanosecond

The nanoseconds of the datetime.

Series.dt.dayofweek

The day of the week with Monday=0, Sunday=6.

Series.dt.day_of_week

The day of the week with Monday=0, Sunday=6.

Series.dt.weekday

The day of the week with Monday=0, Sunday=6.

Series.dt.dayofyear

The ordinal day of the year.

Series.dt.day_of_year

The ordinal day of the year.

Series.dt.days_in_month

The number of days in the month.

Series.dt.daysinmonth

The number of days in the month.

Series.dt.quarter

Returns a series of the quarters of the datetime.

Series.dt.isocalendar()

Calculate year, week, and day according to the ISO 8601 standard.

Series.dt.month_name(...)

Return the month names with specified locale.

Series.dt.day_name(...)

Return the day names with specified locale.

Series.dt.is_month_start

Indicates whether the date is the first day of the month.

Series.dt.is_month_end

Indicates whether the date is the last day of the month.

Series.dt.is_quarter_start

Indicator for whether the date is the first day of a quarter.

Series.dt.is_quarter_end

Indicator for whether the date is the last day of a quarter.

Series.dt.is_year_start

Indicate whether the date is the first day of a year.

Series.dt.is_year_end

Indicate whether the date is the last day of the year.

Series.dt.is_leap_year

Boolean indicator if the date belongs to a leap year.

Series.dt.floor(*args, ...)

Perform floor operation on the data to the specified freq.

Series.dt.ceil(*args, ...)

Perform ceil operation on the data to the specified freq.

Series.dt.round(*args, ...)

Perform round operation on the data to the specified freq.

Series.dt.normalize(...)

Series.dt.days

Number of days for each element.

Series.dt.seconds

Number of seconds (>= 0 and less than 1 day) for each element.

Series.dt.microseconds

Number of microseconds (>= 0 and less than 1 second) for each element.

Series.dt.nanoseconds

Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.

Series.dt.tz_convert(...)

Convert tz-aware Datetime Array/Index from one time zone to another.

Series.dt.tz_localize(...)

Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index.

String accessor methods

All supported Series str APIs

Series.str.capitalize()

Convert strings in the Series/Index to be capitalized.

Series.str.casefold()

Series.str.center(width[, ...])

Series.str.contains(pat[, ...])

Test if pattern or regex is contained within a string of a Series or Index.

Series.str.count(pat[, flags])

Count occurrences of pattern in each string of the Series/Index.

Series.str.endswith(pat[, na])

Test if the end of each string element matches a pattern.

Series.str.get(i)

Extract element from each component at specified position or with specified key.

Series.str.isdigit()

Check whether all characters in each string are digits.

Series.str.islower()

Check whether all characters in each string are lowercase.

Series.str.istitle()

Check whether all characters in each string are uppercase.

Series.str.isupper()

Check whether all characters in each string are uppercase.

Series.str.len()

Get the length of a string.

Series.str.lower()

Series.str.lstrip([to_strip])

Remove leading characters.

Series.str.match(pat[, ...])

Determine if each string starts with a match of a regular expression.

Series.str.replace(pat, repl)

Replace each occurrence of pattern/regex in the Series/Index.

Series.str.rstrip([to_strip])

Remove trailing characters.

Series.str.slice([start, ...])

Slice substrings from each element in the Series or Index.

Series.str.split([pat, n, ...])

Split strings around given separator/delimiter.

Series.str.startswith(pat[, na])

Test if the start of each string element matches a pattern.

Series.str.strip([to_strip])

Remove leading and trailing characters.

Series.str.translate(table)

Map all characters in the string through the given mapping table.

Series.str.upper()

Serialization / IO / conversion

Series.to_csv([path_or_buf, sep, na_rep, ...])

Write object to a comma-separated values (csv) file.