Series

One-dimensional ndarray with axis labels (including time series).

Series(data, {columns: [ Array ], dtypes: [ Array ], index: [Array]}) [source]

Attributes

The index (axis labels) of the Series.

The Tensorflow tensor of the data backing this Series or Index.

Return Series as ndarray or ndarray-like depending on the dtype.

Return the dtype object of the underlying data.

Return a tuple of the shape of the underlying data.

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

Return the number of elements in the underlying data.

Conversion

Cast a Series object to a specified dtype

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

Indexing, iteration

[`Series.loc`](series.loc.md)

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

Purely integer-location based indexing for selection by position.

Binary operator functions

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

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

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

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

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

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

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

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

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

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

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

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

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

Function application

Invoke function on values of Series.

Map values of Series according to input correspondence.

Computations / descriptive stats

Return a Series with absolute numeric value of each element.

Compute correlation with other Series, excluding missing values.

Return number of non-NaN observations in the Series.

Return cumulative maximum over a DataFrame or Series axis.

Return cumulative minimum over a DataFrame or Series axis.

Return cumulative product over a DataFrame or Series axis.

Return cumulative sum over a DataFrame or Series axis.

Generate descriptive statistics.

Return the maximum of the values for the requested axis.

Return the mean of the values for the requested axis.

Return the median of the values for the requested axis.

Return the minimum of the values for the requested axis.

Return the mode(s) of the dataset.

Return sample standard deviation over requested axis.

Return the sum of the values for the requested axis.

Return unbiased variance over requested axis.

Return unique values of Series object.

Return number of unique elements in the object.

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

Return Series with duplicate values removed.

Return the first n rows.

Generate a new DataFrame or Series with the index reset.

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

Return the last n rows.

Missing data handling

Return a new Series with missing values removed.

Fill NaN values using the specified method.

Detect missing values.

Replace values given in to_replace with value.

Logical Comparison

Returns the logical OR between Series and other. Supports element-wise operations and broadcasting.

Returns the logical AND between Series and other. Supports element-wise operations and broadcasting.

Reshaping, sorting

Return the integer indices that would sort the Series values.

Return int position of the smallest value in the Series.

Return int position of the largest value in the Series.

Sort by the values.

Accessors

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

Data TypeAccessor

dt

str

Datetimelike properties

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

Datetime methods

The year of the datetime.

Returns a numeric representation of the month. January=0 - December=11.

Returns the day of the week, in local time

The hours of the datetime.

The minutes of the datetime.

The seconds of the datetime.

Returns the name of the day, of the week, in local time

Returns the day of the month, in local time

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>.

Capitalize the first character of each string

Converts all characters to uppercase.

Converts all characters to lowercase.

Returns the character at the specified index (position).

Joins two or more strings/arrays.

Checks whether a string begins with specified characters.

Checks whether a string ends with specified characters

Checks whether a string contains the specified string/characters.

Returns the position of the first found occurrence of a specified value in a string.

Returns the position of the last found occurrence of a specified value in a string.

Returns a new string with a specified number of copies of an existing string.

Searches a string for a specified value, or regular expression, and returns the position of the match.

Extracts a part of a string and returns a new string.

Splits a string into an array of substrings.

Extracts the characters from a string, beginning at a specified start position, and through the specified number of character.

Extracts the characters from a string, between two specified indices.

Counts the number of characters in each string.

Removes whitespace from both ends of a string.

Joins strings to specified value.

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

Plotting

Series.plot is both a callable method and a namespace attribute for specific plotting methods of the form Series.plot.<kind>.

Vertical bar plot.

Make a box plot of the DataFrame columns.

Make a violin plot of the DataFrame columns.

Draw one histogram of the DataFrame’s columns.

Generate Kernel Density Estimate plot using Gaussian kernels.

Plot Series or DataFrame as lines.

Generate a pie plot.

Time series plots

Display Series as Interactive table in a Div

Serialization / IO / conversion

Convert DataFrame or Series to CSV.

Convert DataFrame or Series to a JSON.

Series.toExcel

Convert DataFrame or Series to an excel file

Last updated