Skip to content

Latest commit

 

History

History
191 lines (152 loc) · 17.3 KB

README.md

File metadata and controls

191 lines (152 loc) · 17.3 KB
description
One-dimensional ndarray with axis labels (including time series).

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`](series.loc.md) 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).

Function application

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.valueCounts Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

Series.dropDuplicates Return Series with duplicate values removed.
Series.head Return the first n rows.
Series.resetIndex 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.droNa 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.

Logical Comparison

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

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.sortValues 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 Returns a numeric representation of the month. January=0 - December=11.
Series.dt.monthName
Series.dt.dayOfWeek Returns the day of the week, in local time
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.dayOfWeekName Returns the name of the day, of the week, in local time
Series.dt.dayOfMonth 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>.

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 a Div

Serialization / IO / conversion

Series.toCSV Convert DataFrame or Series to CSV.
Series.toJSON Convert DataFrame or Series to a JSON.
Series.toExcel Convert DataFrame or Series to an excel file