Series

Constructor

cudf.Series([data, index, dtype, name, nan_as_null])

One-dimensional GPU array (including time series).

Attributes

Axes

Series.index

The index object

Series.values

Return a CuPy representation of the data.

Series.data

The gpu buffer for the data

Series.dtype

dtype of the Series

Series.shape

Returns a tuple representing the dimensionality of the Index.

Series.ndim

Dimension of the data (always 1).

Series.nullable

A boolean indicating whether a null-mask is needed

Series.nullmask

The gpu buffer for the null-mask

Series.null_count

Number of null values

Series.size

Return the number of elements in the underlying data.

Series.memory_usage([index, deep])

Return the memory usage of the Series.

Series.has_nulls

Indicator whether Series contains null values.

Series.empty

Indicator whether DataFrame or Series is empty.

Series.name

The name of this object.

Series.valid_count

Number of non-null values

Series.values_host

Return a NumPy representation of the data.

Conversion

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

Cast the Series to the given dtype

Series.copy([deep])

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

Series.to_list()

Series.__array__([dtype])

Series.as_index()

Returns a new Series with a RangeIndex.

Series.as_mask()

Convert booleans to bitmask

Series.scale()

Scale values to [0, 1] in float64

Indexing, iteration

Series.loc

Select values by label.

Series.iloc

Select values by position.

Series.__iter__()

Iterating over a GPU object is not effecient and hence not supported.

Series.items()

Iterating over a GPU object is not effecient and hence not supported.

Series.iteritems()

Iterating over a GPU object is not effecient and hence not supported.

Series.keys()

Return alias for index.

For more information on .at, .iat, .loc, and .iloc, see the indexing documentation.

Binary operator functions

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

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

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

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

Series.subtract(other[, fill_value, axis])

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

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

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

Series.multiply(other[, fill_value, axis])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Series.round([decimals, how])

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

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

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

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

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

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

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

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

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

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

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

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

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

Series.product([axis, skipna, dtype, level, ...])

Return product of the values in the DataFrame.

Function application, GroupBy & window

Series.applymap(udf[, out_dtype])

Apply an elementwise function to transform the values in the Column.

Series.map(arg[, na_action])

Map values of Series according to input correspondence.

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

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

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

Rolling window calculations.

Series.pipe(func, *args, **kwargs)

Apply func(self, *args, **kwargs).

Computations / descriptive stats

Series.abs()

Absolute value of each element of the series.

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

Return whether all elements are True in DataFrame.

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

Return whether any elements is True in DataFrame.

Series.ceil()

Rounds each value upward to the smallest integral value not less than the original.

Series.clip([lower, upper, inplace, axis])

Trim values at input threshold(s).

Series.corr(other[, method, min_periods])

Calculates the sample correlation between two Series, excluding missing values.

Series.count([level])

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

Series.cov(other[, min_periods])

Compute covariance with Series, excluding missing values.

Series.cummax([axis, skipna])

Return cumulative maximum of the Series or DataFrame.

Series.cummin([axis, skipna])

Return cumulative minimum of the Series or DataFrame.

Series.cumprod([axis, skipna])

Return cumulative product of the Series or DataFrame.

Series.cumsum([axis, skipna])

Return cumulative sum of the Series or DataFrame.

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

Generate descriptive statistics.

Series.diff([periods])

Calculate the difference between values at positions i and i - N in an array and store the output in a new array.

Series.digitize(bins[, right])

Return the indices of the bins to which each value in series belongs.

Series.factorize([na_sentinel])

Encode the input values as integer labels

Series.floor()

Rounds each value downward to the largest integral value not greater than the original.

Series.kurt([axis, skipna, level, numeric_only])

Return Fisher's unbiased kurtosis of a sample.

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

Return the maximum of the values in the DataFrame.

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

Return the mean of the values for the requested axis.

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

Return the median of the values for the requested axis.

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

Return the minimum of the values in the DataFrame.

Series.mode([dropna])

Return the mode(s) of the dataset.

Series.nlargest([n, keep])

Returns a new Series of the n largest element.

Series.nsmallest([n, keep])

Returns a new Series of the n smallest element.

Series.prod([axis, skipna, dtype, level, ...])

Return product of the values in the DataFrame.

Series.quantile([q, interpolation, exact, ...])

Return values at the given quantile.

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

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

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

Return unbiased Fisher-Pearson skew of a sample.

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

Return sample standard deviation of the DataFrame.

Series.sum([axis, skipna, dtype, level, ...])

Return sum of the values in the DataFrame.

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

Return unbiased variance of the DataFrame.

Series.kurtosis([axis, skipna, level, ...])

Return Fisher's unbiased kurtosis of a sample.

Series.unique()

Returns unique values of this Series.

Series.nunique([method, dropna])

Returns the number of unique values of the Series: approximate version, and exact version to be moved to libgdf

Series.is_unique

Return boolean if values in the object are unique.

Series.is_monotonic

Return boolean if values in the object are monotonic_increasing.

Series.is_monotonic_increasing

Return boolean if values in the object are monotonic_increasing.

Series.is_monotonic_decreasing

Return boolean if values in the object are monotonic_decreasing.

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

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

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.equals(other, **kwargs)

Test whether two objects contain the same elements.

Series.head([n])

Return the first n rows.

Series.isin(values)

Check whether values are contained in Series.

Series.reindex([index, copy])

Return a Series that conforms to a new index

Series.rename([index, copy])

Alter Series name

Series.reset_index([drop, inplace])

Reset index to RangeIndex

Series.reverse()

Reverse the Series

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

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

Series.set_index(index)

Returns a new Series with a different index.

Series.set_mask(mask[, null_count])

Create new Series by setting a mask array.

Series.take(indices[, keep_index])

Return Series by taking values from the corresponding indices.

Series.tail([n])

Returns the last n rows as a new DataFrame or Series

Series.tile(count)

Repeats the rows from self DataFrame count times to form a new DataFrame.

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

Replace values where the condition is False.

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

Replace values where the condition is True.

Missing data handling

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

Return a Series with null values removed.

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

Fill null values with value or specified method.

Series.isna()

Identify missing values.

Series.isnull()

Identify missing values.

Series.nans_to_nulls()

Convert nans (if any) to nulls

Series.notna()

Identify non-missing values.

Series.notnull()

Identify non-missing values.

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

Replace values given in to_replace with value.

Reshaping, sorting

Series.argsort([ascending, na_position])

Returns a Series of int64 index that will sort the series.

Series.interleave_columns()

Interleave Series columns of a table into a single column.

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

Sort by the values.

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

Sort by the index.

Series.explode([ignore_index])

Transform each element of a list-like to a row, replicating index values.

Series.scatter_by_map(map_index[, map_size, ...])

Scatter to a list of dataframes.

Series.searchsorted(values[, side, ...])

Find indices where elements should be inserted to maintain order

Series.repeat(repeats[, axis])

Repeats elements consecutively.

Combining / comparing / joining / merging / encoding

Series.append(to_append[, ignore_index, ...])

Append values from another Series or array-like object.

Series.update(other)

Modify Series in place using values from passed Series.

Series.label_encoding(cats[, dtype, na_sentinel])

Perform label encoding

Series.one_hot_encoding(cats[, dtype])

Perform one-hot-encoding

Numerical operations

Series.acos()

Get Trigonometric inverse cosine, element-wise.

Series.asin()

Get Trigonometric inverse sine, element-wise.

Series.atan()

Get Trigonometric inverse tangent, element-wise.

Series.cos()

Get Trigonometric cosine, element-wise.

Series.exp()

Get the exponential of all elements, element-wise.

Series.log()

Get the natural logarithm of all elements, element-wise.

Series.sin()

Get Trigonometric sine, element-wise.

Series.sqrt()

Get the non-negative square-root of all elements, element-wise.

Series.tan()

Get Trigonometric tangent, element-wise.

Accessors

pandas provides dtype-specific methods under various accessors. These are separate namespaces within Series that only apply to specific data types.

Data Type

Accessor

Datetime, Timedelta

dt

String

str

Categorical

cat

List

list

Datetimelike properties

Series.dt can be used to access the values of the series as datetimelike and return several properties. These can be accessed like Series.dt.<property>.

Datetime properties

day

The day of the datetime.

dayofweek

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

hour

The hours of the datetime.

minute

The minutes of the datetime.

month

The month as January=1, December=12.

second

The seconds of the datetime.

weekday

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

year

The year of the datetime.

Datetime methods

strftime(date_format, *args, **kwargs)

Convert to Series using specified date_format.

Timedelta properties

components

Return a Dataframe of the components of the Timedeltas.

days

Number of days.

microseconds

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

nanoseconds

Return the number of nanoseconds (n), where 0 <= n < 1 microsecond.

seconds

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

String handling

Series.str can be used to access the values of the series as strings and apply several methods to it. These can be accessed like Series.str.<function/property>.

byte_count()

Computes the number of bytes of each string in the Series/Index.

capitalize()

Convert strings in the Series/Index to be capitalized.

cat()

Concatenate strings in the Series/Index with given separator.

center(width[, fillchar])

Filling left and right side of strings in the Series/Index with an additional character.

character_ngrams([n])

Generate the n-grams from characters in a column of strings.

character_tokenize()

Each string is split into individual characters.

code_points()

Returns an array by filling it with the UTF-8 code point values for each character of each string.

contains(pat[, case, flags, na, regex])

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

count(pat[, flags])

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

detokenize(indices[, separator])

Combines tokens into strings by concatenating them in the order in which they appear in the indices column.

edit_distance(targets)

The targets strings are measured against the strings in this instance using the Levenshtein edit distance algorithm.

endswith(pat)

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

extract(pat[, flags, expand])

Extract capture groups in the regex pat as columns in a DataFrame.

filter_alphanum([repl, keep])

Remove non-alphanumeric characters from strings in this column.

filter_characters(table[, keep, repl])

Remove characters from each string using the character ranges in the given mapping table.

filter_tokens(min_token_length[, ...])

Remove tokens from within each string in the series that are smaller than min_token_length and optionally replace them with the replacement string.

find(sub[, start, end])

Return lowest indexes in each strings in the Series/Index where the substring is fully contained between [start:end].

findall(pat[, flags, expand])

Find all occurrences of pattern or regular expression in the Series/Index.

get([i])

Extract element from each component at specified position.

get_json_object(json_path)

Applies a JSONPath string to an input strings column where each row in the column is a valid json string

htoi()

Returns integer value represented by each hex string.

index(sub[, start, end])

Return lowest indexes in each strings where the substring is fully contained between [start:end].

insert([start, repl])

Insert the specified string into each string in the specified position.

ip2int()

This converts ip strings to integers

is_consonant(position)

Return true for strings where the character at position is a consonant.

is_vowel(position)

Return true for strings where the character at position is a vowel -- not a consonant.

isalnum()

Check whether all characters in each string are alphanumeric.

isalpha()

Check whether all characters in each string are alphabetic.

isdecimal()

Check whether all characters in each string are decimal.

isdigit()

Check whether all characters in each string are digits.

isempty()

Check whether each string is an empty string.

isfloat()

Check whether all characters in each string form floating value.

ishex()

Check whether all characters in each string form a hex integer.

isinteger()

Check whether all characters in each string form integer.

isipv4()

Check whether all characters in each string form an IPv4 address.

isspace()

Check whether all characters in each string are whitespace.

islower()

Check whether all characters in each string are lowercase.

isnumeric()

Check whether all characters in each string are numeric.

isupper()

Check whether all characters in each string are uppercase.

istimestamp(format)

Check whether all characters in each string can be converted to a timestamp using the given format.

join([sep, string_na_rep, sep_na_rep])

Join lists contained as elements in the Series/Index with passed delimiter.

len()

Computes the length of each element in the Series/Index.

ljust(width[, fillchar])

Filling right side of strings in the Series/Index with an additional character.

lower()

Converts all characters to lowercase.

lstrip([to_strip])

Remove leading and trailing characters.

match(pat[, case, flags])

Determine if each string matches a regular expression.

ngrams([n, separator])

Generate the n-grams from a set of tokens, each record in series is treated a token.

ngrams_tokenize([n, delimiter, separator])

Generate the n-grams using tokens from each string.

normalize_characters([do_lower])

Normalizes strings characters for tokenizing.

pad(width[, side, fillchar])

Pad strings in the Series/Index up to width.

partition([sep, expand])

Split the string at the first occurrence of sep.

porter_stemmer_measure()

Compute the Porter Stemmer measure for each string.

replace(pat, repl[, n, case, flags, regex])

Replace occurrences of pattern/regex in the Series/Index with some other string.

replace_tokens(targets, replacements[, ...])

The targets tokens are searched for within each string in the series and replaced with the corresponding replacements if found.

replace_with_backrefs(pat, repl)

Use the repl back-ref template to create a new string with the extracted elements found using the pat expression.

rfind(sub[, start, end])

Return highest indexes in each strings in the Series/Index where the substring is fully contained between [start:end].

rindex(sub[, start, end])

Return highest indexes in each strings where the substring is fully contained between [start:end].

rjust(width[, fillchar])

Filling left side of strings in the Series/Index with an additional character.

rpartition([sep, expand])

Split the string at the last occurrence of sep.

rstrip([to_strip])

Remove leading and trailing characters.

slice([start, stop, step])

Slice substrings from each element in the Series or Index.

slice_from(starts, stops)

Return substring of each string using positions for each string.

slice_replace([start, stop, repl])

Replace the specified section of each string with a new string.

split([pat, n, expand])

Split strings around given separator/delimiter.

rsplit([pat, n, expand])

Split strings around given separator/delimiter.

startswith(pat)

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

strip([to_strip])

Remove leading and trailing characters.

subword_tokenize(hash_file[, max_length, ...])

Run CUDA BERT subword tokenizer on cuDF strings column.

swapcase()

Change each lowercase character to uppercase and vice versa.

title()

Uppercase the first letter of each letter after a space and lowercase the rest.

token_count([delimiter])

Each string is split into tokens using the provided delimiter.

tokenize([delimiter])

Each string is split into tokens using the provided delimiter(s).

translate(table)

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

upper()

Convert each string to uppercase.

url_decode()

Returns a URL-decoded format of each string.

url_encode()

Returns a URL-encoded format of each string.

wrap(width, **kwargs)

Wrap long strings in the Series/Index to be formatted in paragraphs with length less than a given width.

zfill(width)

Pad strings in the Series/Index by prepending ‘0’ characters.

Categorical accessor

Categorical-dtype specific methods and attributes are available under the Series.cat accessor.

categories

The categories of this categorical.

ordered

Whether the categories have an ordered relationship.

codes

Return Series of codes as well as the index.

reorder_categories(new_categories[, ...])

Reorder categories as specified in new_categories.

add_categories(new_categories[, inplace])

Add new categories.

remove_categories(removals[, inplace])

Remove the specified categories.

set_categories(new_categories[, ordered, ...])

Set the categories to the specified new_categories.

as_ordered([inplace])

Set the Categorical to be ordered.

as_unordered([inplace])

Set the Categorical to be unordered.

List handling

Series.list can be used to access the values of the series as lists and apply list methods to it. These can be accessed like Series.list.<function/property>.

concat([dropna])

For a column with at least one level of nesting, concatenate the lists in each row.

contains(search_key)

Returns boolean values indicating whether the specified scalar is an element of each row.

get(index)

Extract element at the given index from each component

len()

Computes the length of each element in the Series/Index.

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

Sort each list by the values.

take(lists_indices)

Collect list elements based on given indices.

unique()

Returns the unique elements in each list.

Serialization / IO / conversion

Series.to_array([fillna])

Get a dense numpy array for the data.

Series.to_arrow()

Convert to a PyArrow Array.

Series.to_dlpack()

Converts a cuDF object into a DLPack tensor.

Series.to_frame([name])

Convert Series into a DataFrame

Series.to_gpu_array([fillna])

Get a dense numba device array for the data.

Series.to_hdf(path_or_buf, key, *args, **kwargs)

Write the contained data to an HDF5 file using HDFStore.

Series.to_json([path_or_buf])

Convert the cuDF object to a JSON string.

Series.to_pandas([index, nullable])

Convert to a Pandas Series.

Series.to_string()

Convert to string

Series.from_arrow(array)

Create from PyArrow Array/ChunkedArray.

Series.from_categorical(categorical[, codes])

Creates from a pandas.Categorical

Series.from_masked_array(data, mask[, ...])

Create a Series with null-mask.

Series.from_pandas(s[, nan_as_null])

Convert from a Pandas Series.

Series.hash_encode(stop[, use_name])

Encode column values as ints in [0, stop) using hash function.

Series.hash_values()

Compute the hash of values in this column.