Series

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

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

Attributes

Series.index

The index (axis labels) of the Series.

Series.tensor

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

Series.values

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

Series.dtype

Return the dtype object of the underlying data.

Series.shape

Return a tuple of the shape of the underlying data.

Series.ndim

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

Series.size

Return the number of elements in the underlying data.

Conversion

Series.astype

Cast a Series object to a specified dtype

Series.copy

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

Indexing, iteration

Series.loc

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

Series.iloc

Purely integer-location based indexing for selection by position.

Binary operator functions

Series.add

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

Series.sub

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

Series.mul

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

Series.div

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

Series.mod

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

Series.pow

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

Series.round

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

Series.lt

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

Series.gt

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

Series.le

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

Series.ge

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

Series.ne

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

Series.eq

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

Series.dot

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

Function application & GroupBy

Series.apply

Invoke function on values of Series.

Series.map

Map values of Series according to input correspondence.

Computations / descriptive stats

Series.abs

Return a Series with absolute numeric value of each element.

Series.corr

Compute correlation with other Series, excluding missing values.

Series.count

Return number of non-NaN observations in the Series.

Series.cummax

Return cumulative maximum over a DataFrame or Series axis.

Series.cummin

Return cumulative minimum over a DataFrame or Series axis.

Series.cumprod

Return cumulative product over a DataFrame or Series axis.

Series.cumsum

Return cumulative sum over a DataFrame or Series axis.

Series.describe

Generate descriptive statistics.

Series.max

Return the maximum of the values for the requested axis.

Series.mean

Return the mean of the values for the requested axis.

Series.median

Return the median of the values for the requested axis.

Series.min

Return the minimum of the values for the requested axis.

Series.mode

Return the mode(s) of the dataset.

Series.std

Return sample standard deviation over requested axis.

Series.sum

Return the sum of the values for the requested axis.

Series.var

Return unbiased variance over requested axis.

Series.unique

Return unique values of Series object.

Series.nunique

Return number of unique elements in the object.

Series.value_counts

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

Series.drop_duplicates

Return Series with duplicate values removed.

Series.head

Return the first n rows.

Series.reset_index

Generate a new DataFrame or Series with the index reset.

Series.sample

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

Series.tail

Return the last n rows.

Missing data handling

Series.dropna

Return a new Series with missing values removed.

Series.fillna

Fill NaN values using the specified method.

Series.isna

Detect missing values.

Series.replace

Replace values given in to_replace with value.

Reshaping, sorting

Series.argsort

Return the integer indices that would sort the Series values.

Series.argmin

Return int position of the smallest value in the Series.

Series.argmax

Return int position of the largest value in the Series.

Series.sort_values

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 Type

Accessor

Datetime

dt

String

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

Series.dt.year

The year of the datetime.

Series.dt.month

The month as January=1, December=12.

Series.dt.day

The day of the datetime.

Series.dt.hour

The hours of the datetime.

Series.dt.minute

The minutes of the datetime.

Series.dt.second

The seconds of the datetime.

Series.dt.weekdays

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

Series.dt.month_name

Return the month names of the DateTimeIndex with specified locale.

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

Series.str.capitalize

Capitalize the first character of each string

Series.str.toUpperCase

Converts all characters to uppercase.

Series.str.toLowerCase

Converts all characters to lowercase.

Series.str.charAt

Returns the character at the specified index (position).

Series.str.concat

Joins two or more strings/arrays.

Series.str.startsWith

Checks whether a string begins with specified characters.

Series.str.endsWith

Checks whether a string ends with specified characters

Series.str.includes

Checks whether a string contains the specified string/characters.

Series.str.indexOf

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

Series.str.lastIndexOf

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

Series.str.repeat

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

Series.str.search

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

Series.str.slice

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

Series.str.split

Splits a string into an array of substrings.

Series.str.substr

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

Series.str.substring

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

Series.str.len

Counts the number of characters in each string.

Series.str.trim

Removes whitespace from both ends of a string.

Series.str.join

Joins strings to specified value.

Series.str.replace

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

Series.plot.bar

Vertical bar plot.

Series.plot.box

Make a box plot of the DataFrame columns.

Series.plot.violin

Make a violin plot of the DataFrame columns.

Series.plot.hist

Draw one histogram of the DataFrame’s columns.

Series.plot.scatter

Generate Kernel Density Estimate plot using Gaussian kernels.

Series.plot.line

Plot Series or DataFrame as lines.

Series.plot.pie

Generate a pie plot.

Timeseries Plots

Time series plots

Table

Display Series as Interactive table in Div

Serialization / IO / conversion

Series.to_csv

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

Series.to_json

Convert the object to a JSON string.