Series#
Constructor#
|
Attributes#
Axes
The index (axis labels) of the Series. |
Return the dtype object of the underlying data. |
|
|
Return the memory usage of the Series. |
Return an int representing the number of axes / array dimensions. |
|
Return the transpose, which is by definition self. |
Conversion#
|
Cast a pandas object to a specified dtype |
|
Convert columns to best possible dtypes using dtypes supporting |
|
Make a copy of this object's indices and data. |
|
Attempt to infer better dtypes for object columns. |
|
Convert Series to DataFrame. |
Index, iteration#
Access a single value for a row/column label pair. |
|
Access a single value for a row/column pair by integer position. |
|
Purely integer-location based indexing for selection by position. |
|
Access a group of rows and columns by label(s) or a boolean array. |
|
|
Replace values where the condition is True. |
|
Return item and drops from series. |
|
Return cross-section from the Series/DataFrame. |
|
Replace values where the condition is False. |
Binary operator functions#
|
Return Addition of series and other, element-wise (binary operator add). |
|
Return Subtraction of series and other, element-wise (binary operator subtract). |
|
Return Multiplication of series and other, element-wise (binary operator mul). |
|
Return Floating division of series and other, element-wise (binary operator truediv). |
|
Return Floating division of series and other, element-wise (binary operator truediv). |
|
Return Integer division of series and other, element-wise (binary operator floordiv). |
|
Return Modulo of series and other, element-wise (binary operator mod). |
|
Return Exponential power of series and other, element-wise (binary operator pow). |
|
Return Addition of series and other, element-wise (binary operator radd). |
|
Return Subtraction of series and other, element-wise (binary operator rsubtract). |
|
Return Multiplication of series and other, element-wise (binary operator rmul). |
|
Return Floating division of series and other, element-wise (binary operator rtruediv). |
|
Return Floating division of series and other, element-wise (binary operator rtruediv). |
|
Return Integer division of series and other, element-wise (binary operator rfloordiv). |
|
Return Modulo of series and other, element-wise (binary operator rmod). |
|
Return Exponential power of series and other, element-wise (binary operator rpow). |
|
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). |
|
Combine the Series with a Series or scalar according to func. |
|
Update null elements with value in the same location in 'other'. |
Function application, groupby & window#
|
Invoke function on values of Series. |
|
Aggregate using one or more operations over the specified axis. |
|
Aggregate using one or more operations over the specified axis. |
|
Provide exponential weighted functions. |
|
Provide expanding transformations. |
|
Group DataFrame using a mapper or by a Series of columns. |
|
Map values of Series according to input correspondence. |
|
Provide rolling window calculations. |
|
Call |
Computations / descriptive stats#
|
|
|
|
|
Return boolean Series equivalent to left <= series <= right. |
|
Trim values at input threshold(s). |
|
Compute correlation with other Series, excluding missing values. |
|
|
|
Compute covariance with Series, excluding missing values. |
|
Generate descriptive statistics. |
|
Encode the object as an enumerated type or categorical variable. |
Return boolean scalar if values in the object are monotonic_increasing. |
|
Return boolean scalar if values in the object are monotonic_decreasing. |
|
Return boolean if values in the object are unique. |
|
|
|
|
|
|
|
|
|
|
Return the mode(s) of the Series. |
|
Return the largest n elements. |
|
Return the smallest n elements. |
|
Return number of unique elements in the object. |
|
|
|
|
|
Return value at the given quantile. |
|
Compute numerical data ranks (1 through n) along axis. |
|
Round each value in a Series to the given number of decimals. |
|
|
|
|
|
|
|
Uniques are returned in order of appearance. |
|
Return a Series containing counts of unique values. |
|
Reindexing / selection / label manipulation#
|
Prefix labels with string prefix. |
|
Suffix labels with string suffix. |
|
Align two objects on their axes with the specified join method. |
|
Select values at particular time of day (e.g., 9:30AM). |
|
Select values between particular times of the day (e.g., 9:00-9:30 AM). |
|
Replace values where the conditions are True. |
|
Return Series with specified index labels removed. |
|
Return Series with duplicate values removed. |
|
Return Series/DataFrame with requested index / column level(s) removed. |
|
Subset the dataframe rows or columns according to the specified index labels. |
|
Return the first n rows. |
|
Return the row label of the maximum value. |
|
Return the row label of the minimum value. |
|
Whether elements in Series are contained in values. |
|
Conform Series/DataFrame to new index with optional filling logic. |
|
Return an object with matching indices as other object. |
|
Alter Series index labels or name. |
|
Generate a new DataFrame or Series with the index reset. |
|
Return a random sample of items from an axis of object. |
|
Assign desired index to given axis. |
|
Return the elements in the given positional indices along an axis. |
|
Truncate a Series or DataFrame before and after some index value. |
Missing data handling#
|
Return a new Series with missing values removed. |
|
Fill NA/NaN values using the specified method. |
Detect missing values. |
|
Detect existing (non-missing) values. |
|
|
Return a new Series with missing values removed. |
|
Fill NA/NaN values using the specified method. |
Reshaping, sorting#
|
Return int position of the smallest value in the Series. |
|
Return int position of the smallest value in the Series. |
|
Return the integer indices that would sort the Series values. |
|
Transform each element of a list-like to a row. |
|
Rearrange index levels using input order. |
|
Repeat elements of a Series. |
|
Sort by the values. |
|
Sort object by labels (along an axis). |
|
Swap levels i and j in a |
|
Unstack, also known as pivot, Series with MultiIndex to produce DataFrame. |
Combining / comparing / joining / merging#
|
Append rows of other to the end of caller, returning a new object. |
|
Compare to another Series and show the differences. |
|
Modify Series in place using values from passed Series. |
Accessors#
Pandas provides dtype-specific methods under various accessors.
These are separate namespaces within Series that only apply
to specific data types.
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#
Returns numpy array of python |
|
Returns numpy array of |
|
Returns numpy array of |
|
The year of the datetime. |
|
The month as January=1, December=12. |
|
The day of the datetime. |
|
The hours of the datetime. |
|
The minutes of the datetime. |
|
The seconds of the datetime. |
|
The microseconds of the datetime. |
|
The nanoseconds of the datetime. |
|
The week ordinal of the year according to the ISO 8601 standard. |
|
The week ordinal of the year according to the ISO 8601 standard. |
|
The day of the week with Monday=0, Sunday=6. |
|
The day of the week with Monday=0, Sunday=6. |
|
The ordinal day of the year. |
|
The quarter of the date. |
|
Indicates whether the date is the first day of the month. |
|
Indicates whether the date is the last day of the month. |
|
Indicator for whether the date is the first day of a quarter. |
|
Indicator for whether the date is the last day of a quarter. |
|
Indicate whether the date is the first day of a year. |
|
Indicate whether the date is the last day of the year. |
|
Boolean indicator if the date belongs to a leap year. |
|
The number of days in the month. |
|
The number of days in the month. |
Datetime methods#
|
Cast to PeriodArray/Index at a particular frequency. |
Return the data as an array of |
|
|
Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index. |
|
Convert tz-aware Datetime Array/Index from one time zone to another. |
|
Convert times to midnight. |
|
Convert to Index using specified date_format. |
|
Perform round operation on the data to the specified freq. |
|
Perform floor operation on the data to the specified freq. |
|
Perform ceil operation on the data to the specified freq. |
|
Return the month names with specified locale. |
|
Return the day names 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>.
Convert strings in the Series/Index to be capitalized. |
|
|
Test if pattern or regex is contained within a string of a Series or Index. |
|
Count occurrences of pattern in each string of the Series/Index. |
|
Test if the end of each string element matches a pattern. |
|
Return lowest indexes in each strings in the Series/Index. |
Compute the length of each element in the Series/Index. |
|
|
Pad right side of strings in the Series/Index. |
Convert strings in the Series/Index to lowercase. |
|
|
Remove leading characters. |
|
Pad strings in the Series/Index up to width. |
|
Duplicate each string in the Series or Index. |
|
Replace each occurrence of pattern/regex in the Series/Index. |
|
Return highest indexes in each strings in the Series/Index. |
|
Pad left side of strings in the Series/Index. |
|
Remove trailing characters. |
|
Slice substrings from each element in the Series or Index. |
|
Test if the start of each string element matches a pattern. |
|
Remove leading and trailing characters. |
Convert strings in the Series/Index to be swapcased. |
|
Convert strings in the Series/Index to titlecase. |
|
|
Map all characters in the string through the given mapping table. |
Convert strings in the Series/Index to uppercase. |
|
|
Pad strings in the Series/Index by prepending '0' characters. |
Check whether all characters in each string are alphanumeric. |
|
Check whether all characters in each string are alphabetic. |
|
Check whether all characters in each string are digits. |
|
Check whether all characters in each string are whitespace. |
|
Check whether all characters in each string are lowercase. |
|
Check whether all characters in each string are uppercase. |
|
Check whether all characters in each string are titlecase. |
|
Check whether all characters in each string are numeric. |
|
Check whether all characters in each string are decimal. |
Dict properties#
Series.dict can be used to access the methods of the series with dict values.
These can be accessed like Series.dict.<method>.
Dict methods#
|
Get the value by the key of each dict in the Series. |
|
Set the value with the key to each dict of the Series. |
|
Check whether the key is in each dict of the Series. |
|
Get the value by the key of each dict in the Series. |
Get the length of each dict of the Series. |
|
|
Remove the item by the key from each dict of the Series. |
List properties#
Series.list can be used to access the methods of the series with list values.
These can be accessed like Series.list.<method>.
List methods#
|
Get the value by the index of each list in the Series. |
Get the length of each list of the Series. |
Struct properties#
Series.struct can be used to access the methods of the series with struct values.
These can be accessed like Series.struct.<method>.
Struct methods#
Return the dtype object of each child field of the struct. |
|
|
Extract a child field of a struct as a Series. |
Plotting#
Series.plot is both a callable method and a namespace attribute for
specific plotting methods of the form Series.plot.<kind>.
|
Draw a stacked area plot. |
|
Vertical bar plot. |
|
Make a horizontal bar plot. |
|
Make a box plot of the DataFrame columns. |
|
Generate Kernel Density Estimate plot using Gaussian kernels. |
|
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. |
Serialization / IO / conversion#
|
Write object to a comma-separated values (csv) file. |
|
Convert Series to {label -> value} dict or dict-like object. |
|
Convert the object to a JSON string. |
|
Return a list of the values. |
MaxFrame Extensions#
|
Apply a function that takes pandas Series and outputs pandas DataFrame/Series. |
|
Apply the given function to each row and then flatten results. |
|
Flat JSON object in the series to a dataframe according to JSON query. |
|
Rechunk DataFrame, Series or Index data. |
Series.mf The Series.mf provides methods unique to MaxFrame. These methods are collated from application
scenarios in MaxCompute and these can be accessed like Series.mf.<function/property>.