Pandas - Series Functions
The Pandas Series has a number of built-in functions that are always available for use. For example, pop() function is used to delete the element of specified label from the series. The most frequently used functions of pandas series are listed below:
Pandas - Series Functions
Indexing / Iteration
Function | Description |
---|---|
iat[] | Access a single value for a row/column pair by integer position. |
head() | Returns the first specified number of rows. |
iloc[] | Purely integer-location based indexing for selection by position. |
items() | Lazily iterate over (index, value) tuples. |
iteritems() | Lazily iterate over (index, value) tuples. |
pop() | Return item and drops from series. |
tail() | Returns the last specified number of rows. |
Binary Operators
Function | Description |
---|---|
add() | Returns addition of series and argument, element-wise. |
sub() | Returns subtraction of series and argument, element-wise. |
mul() | Returns multiplication of series and argument, element-wise. |
div() | Returns floating division of series and argument, element-wise. |
truediv() | Returns floating division of series and argument, element-wise. |
floordiv() | Returns integer division of series and argument, element-wise. |
mod() | Returns modulo of series and argument, element-wise. |
pow() | Returns exponential power of series and argument, element-wise. |
lt() | Get less than of series and argument, element-wise. |
gt() | Get greater than of series and argument, element-wise. |
le() | Get less than equal to of series and argument, element-wise. |
ge() | Get greater than equal to of series and argument, element-wise. |
eq() | Get equal to of series and argument, element-wise. |
ne() | Get Not equal to of series and argument, element-wise. |
Computation / Descriptive stats
Function | Description |
---|---|
abs() | Returns the absolute numeric value of each element. |
clip() | Trim values at input threshold(s). |
corr() | Computes correlation with other Series, excluding missing values. |
count() | Returns the count of non-NA cells for each column or row. |
cov() | Computes covariance with other Series, excluding missing values. |
cummax() | Return cumulative maximum over a DataFrame or Series axis. |
cummin() | Return cumulative minimum over a DataFrame or Series axis. |
cumprod() | Return cumulative product over a DataFrame or Series axis. |
cumsum() | Return cumulative sum over a DataFrame or Series axis. |
diff() | Returns first discrete difference of element. |
kurt() | Returns unbiased kurtosis over the specified axis. |
kurtosis() | Returns unbiased kurtosis over the specified axis. |
max() | Returns the maximum of the values over the specified axis. |
mean() | Returns the mean of the values over the specified axis. |
median() | Returns the median of the values over the specified axis. |
min() | Returns the minimum of the values over the specified axis. |
mode() | Returns the mode(s) of the series. |
pct_change() | Returns percentage change between the current and a prior element. |
nunique() | Count distinct observations over requested axis. |
prod() | Returns the product of the values over the specified axis. |
product() | Returns the product of the values over the specified axis. |
rank() | Computes numerical data ranks (1 through n) along axis. |
round() | Rounds a Series to a specified number of decimal places. |
skew() | Returns unbiased skew over the specified axis. |
std() | Returns the sample standard deviation over the specified axis. |
sum() | Returns the sum of the values over the specified axis. |
value_counts() | Returns a Series containing counts of unique values. |
var() | Returns unbiased variance over the specified axis. |
Reindexing / Selection / Label manipulation
Function | Description |
---|---|
drop_duplicates() | Returns Series with duplicate values removed. |
Combining / Comparing / Joining / Merging
Function | Description |
---|---|
append() | Concatenate two or more Series. |
Function application, GroupBy & window
Function | Description |
---|---|
agg() | Aggregate using one or more operations over the specified axis. |
aggregate() | Aggregate using one or more operations over the specified axis. |
expanding() | Provide expanding transformations. |
map() | Map values of Series according to input correspondence. |
transform() | Call func on self producing a Series with transformed values. |
Time Series-related
Function | Description |
---|---|
shift() | Shift index by specified number of periods with an optional time freq. |
Missing data handling
Function | Description |
---|---|
fillna() | Fill NA/NaN values using the specified method. |