Replace values given in to_replace with value.
Values of the Series are replaced with other values dynamically.
This differs from updating with .loc or .iloc, which require you to specify a location to update with some value.
How to find the values that will be replaced.
numeric, str or regex:
numeric: numeric values equal to to_replace will be replaced with value
str: string exactly matching to_replace will be replaced with value
regex: regexs matching to_replace will be replaced with value
list of str, regex, or numeric:
First, if to_replace and value are both lists, they must be the same length.
Second, if regex=True then all of the strings in both lists will be interpreted as regexs otherwise they will match directly. This doesn’t matter much for value since there are only a few possible substitution regexes you can use.
str, regex and numeric rules apply as above.
dict:
Dicts can be used to specify different replacement values for different existing values. For example, {'a': 'b', 'y': 'z'} replaces the value ‘a’ with ‘b’ and ‘y’ with ‘z’. To use a dict in this way the value parameter should be None.
For a DataFrame a dict can specify that different values should be replaced in different columns. For example, {'a': 1, 'b': 'z'} looks for the value 1 in column ‘a’ and the value ‘z’ in column ‘b’ and replaces these values with whatever is specified in value. The value parameter should not be None in this case. You can treat this as a special case of passing two lists except that you are specifying the column to search in.
For a DataFrame nested dictionaries, e.g., {'a': {'b': np.nan}}, are read as follows: look in column ‘a’ for the value ‘b’ and replace it with NaN. The value parameter should be None to use a nested dict in this way. You can nest regular expressions as well. Note that column names (the top-level dictionary keys in a nested dictionary) cannot be regular expressions.
None:
This means that the regex argument must be a string, compiled regular expression, or list, dict, ndarray or Series of such elements. If value is also None then this must be a nested dictionary or Series.
See the examples section for examples of each of these.
Value to replace any values matching to_replace with. For a DataFrame a dict of values can be used to specify which value to use for each column (columns not in the dict will not be filled). Regular expressions, strings and lists or dicts of such objects are also allowed.
If True, performs operation inplace and returns None.
Maximum size gap to forward or backward fill.
Whether to interpret to_replace and/or value as regular expressions. If this is True then to_replace must be a string. Alternatively, this could be a regular expression or a list, dict, or array of regular expressions in which case to_replace must be None.
The method to use when for replacement, when to_replace is a scalar, list or tuple and value is None.
Changed in version 0.23.0: Added to DataFrame.
Object after replacement.
If regex is not a bool and to_replace is not None.
If to_replace is not a scalar, array-like, dict, or None
If to_replace is a dict and value is not a list, dict, ndarray, or Series
If to_replace is None and regex is not compilable into a regular expression or is a list, dict, ndarray, or Series.
When replacing multiple bool or datetime64 objects and the arguments to to_replace does not match the type of the value being replaced
If a list or an ndarray is passed to to_replace and value but they are not the same length.
See also
Fill NA values.
Replace values based on boolean condition.
Simple string replacement.
Notes
Regex substitution is performed under the hood with re.sub. The rules for substitution for re.sub are the same.
Regular expressions will only substitute on strings, meaning you cannot provide, for example, a regular expression matching floating point numbers and expect the columns in your frame that have a numeric dtype to be matched. However, if those floating point numbers are strings, then you can do this.
This method has a lot of options. You are encouraged to experiment and play with this method to gain intuition about how it works.
When dict is used as the to_replace value, it is like key(s) in the dict are the to_replace part and value(s) in the dict are the value parameter.
Examples
Scalar `to_replace` and `value`
List-like `to_replace`
dict-like `to_replace`
Regular expression `to_replace`
Compare the behavior of s.replace({'a': None}) and s.replace('a', None) to understand the peculiarities of the to_replace parameter:
When one uses a dict as the to_replace value, it is like the value(s) in the dict are equal to the value parameter. s.replace({'a': None}) is equivalent to s.replace(to_replace={'a': None}, value=None, method=None):
When value is not explicitly passed and to_replace is a scalar, list or tuple, replace uses the method parameter (default ‘pad’) to do the replacement. So this is why the ‘a’ values are being replaced by 10 in rows 1 and 2 and ‘b’ in row 4 in this case.
On the other hand, if None is explicitly passed for value, it will be respected:
Changed in version 1.4.0: Previously the explicit None was silently ignored.


Resample time-series data.
Convenience method for frequency conversion and resampling of time series. The object must have a datetime-like index (DatetimeIndex, PeriodIndex, or TimedeltaIndex), or the caller must pass the label of a datetime-like series/index to the on/level keyword parameter.
The offset string or object representing target conversion.
Which axis to use for up- or down-sampling. For Series this will default to 0, i.e. along the rows. Must be DatetimeIndex, TimedeltaIndex or PeriodIndex.
Which side of bin interval is closed. The default is ‘left’ for all frequency offsets except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.
Which bin edge label to label bucket with. The default is ‘left’ for all frequency offsets except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.
For PeriodIndex only, controls whether to use the start or end of rule.
Pass ‘timestamp’ to convert the resulting index to a DateTimeIndex or ‘period’ to convert it to a PeriodIndex. By default the input representation is retained.
Adjust the resampled time labels.
Deprecated since version 1.1.0: You should add the loffset to the df.index after the resample. See below.
For frequencies that evenly subdivide 1 day, the “origin” of the aggregated intervals. For example, for ‘5min’ frequency, base could range from 0 through 4. Defaults to 0.
Deprecated since version 1.1.0: The new arguments that you should use are ‘offset’ or ‘origin’.
For a DataFrame, column to use instead of index for resampling. Column must be datetime-like.
For a MultiIndex, level (name or number) to use for resampling. level must be datetime-like.
The timestamp on which to adjust the grouping. The timezone of origin must match the timezone of the index. If string, must be one of the following:
‘epoch’: origin is 1970-01-01
‘start’: origin is the first value of the timeseries
‘start_day’: origin is the first day at midnight of the timeseries
New in version 1.1.0.
‘end’: origin is the last value of the timeseries
‘end_day’: origin is the ceiling midnight of the last day
New in version 1.3.0.
An offset timedelta added to the origin.
New in version 1.1.0.
Resampler object.
See also
Resample a Series.
Resample a DataFrame.
Group Series by mapping, function, label, or list of labels.
Reindex a Series with the given frequency without grouping.
Notes
See the user guide for more.
To learn more about the offset strings, please see this link.
Examples
Start by creating a series with 9 one minute timestamps.
Downsample the series into 3 minute bins and sum the values of the timestamps falling into a bin.
Downsample the series into 3 minute bins as above, but label each bin using the right edge instead of the left. Please note that the value in the bucket used as the label is not included in the bucket, which it labels. For example, in the original series the bucket 2000-01-01 00:03:00 contains the value 3, but the summed value in the resampled bucket with the label 2000-01-01 00:03:00 does not include 3 (if it did, the summed value would be 6, not 3). To include this value close the right side of the bin interval as illustrated in the example below this one.
Downsample the series into 3 minute bins as above, but close the right side of the bin interval.
Upsample the series into 30 second bins.
Upsample the series into 30 second bins and fill the NaN values using the pad method.
Upsample the series into 30 second bins and fill the NaN values using the bfill method.
Pass a custom function via apply
For a Series with a PeriodIndex, the keyword convention can be used to control whether to use the start or end of rule.
Resample a year by quarter using ‘start’ convention. Values are assigned to the first quarter of the period.
Resample quarters by month using ‘end’ convention. Values are assigned to the last month of the period.
For DataFrame objects, the keyword on can be used to specify the column instead of the index for resampling.
For a DataFrame with MultiIndex, the keyword level can be used to specify on which level the resampling needs to take place.
If you want to adjust the start of the bins based on a fixed timestamp:
If you want to adjust the start of the bins with an offset Timedelta, the two following lines are equivalent:
If you want to take the largest Timestamp as the end of the bins:
In contrast with the start_day, you can use end_day to take the ceiling midnight of the largest Timestamp as the end of the bins and drop the bins not containing data:
To replace the use of the deprecated base argument, you can now use offset, in this example it is equivalent to have base=2:
To replace the use of the deprecated loffset argument:


Generate a new DataFrame or Series with the index reset.
This is useful when the index needs to be treated as a column, or when the index is meaningless and needs to be reset to the default before another operation.
For a Series with a MultiIndex, only remove the specified levels from the index. Removes all levels by default.
Just reset the index, without inserting it as a column in the new DataFrame.
The name to use for the column containing the original Series values. Uses self.name by default. This argument is ignored when drop is True.
Modify the Series in place (do not create a new object).
When drop is False (the default), a DataFrame is returned. The newly created columns will come first in the DataFrame, followed by the original Series values. When drop is True, a Series is returned. In either case, if inplace=True, no value is returned.
See also
Analogous function for DataFrame.
Examples
Generate a DataFrame with default index.
To specify the name of the new column use name.
To generate a new Series with the default set drop to True.
To update the Series in place, without generating a new one set inplace to True. Note that it also requires drop=True.
The level parameter is interesting for Series with a multi-level index.
To remove a specific level from the Index, use level.
If level is not set, all levels are removed from the Index.


Return Integer division of series and other, element-wise (binary operator rfloordiv).
Equivalent to other // series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Integer division, see Python documentation for more details.
Examples


Return Modulo of series and other, element-wise (binary operator rmod).
Equivalent to other % series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Modulo, see Python documentation for more details.
Examples


Return Multiplication of series and other, element-wise (binary operator rmul).
Equivalent to other * series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Multiplication, see Python documentation for more details.
Examples


Provide rolling window calculations.
Size of the moving window.
If an integer, the fixed number of observations used for each window.
If an offset, the time period of each window. Each window will be a variable sized based on the observations included in the time-period. This is only valid for datetimelike indexes. To learn more about the offsets & frequency strings, please see this link.
If a BaseIndexer subclass, the window boundaries based on the defined get_window_bounds method. Additional rolling keyword arguments, namely min_periods, center, and closed will be passed to get_window_bounds.
Minimum number of observations in window required to have a value; otherwise, result is np.nan.
For a window that is specified by an offset, min_periods will default to 1.
For a window that is specified by an integer, min_periods will default to the size of the window.
If False, set the window labels as the right edge of the window index.
If True, set the window labels as the center of the window index.
If None, all points are evenly weighted.
If a string, it must be a valid scipy.signal window function.
Certain Scipy window types require additional parameters to be passed in the aggregation function. The additional parameters must match the keywords specified in the Scipy window type method signature.
For a DataFrame, a column label or Index level on which to calculate the rolling window, rather than the DataFrame’s index.
Provided integer column is ignored and excluded from result since an integer index is not used to calculate the rolling window.
If 0 or 'index', roll across the rows.
If 1 or 'columns', roll across the columns.
If 'right', the first point in the window is excluded from calculations.
If 'left', the last point in the window is excluded from calculations.
If 'both', the no points in the window are excluded from calculations.
If 'neither', the first and last points in the window are excluded from calculations.
Default None ('right').
Changed in version 1.2.0: The closed parameter with fixed windows is now supported.
New in version 1.3.0.
Execute the rolling operation per single column or row ('single') or over the entire object ('table').
This argument is only implemented when specifying engine='numba' in the method call.
See also
Provides expanding transformations.
Provides exponential weighted functions.
Notes
See Windowing Operations for further usage details and examples.
Examples
window
Rolling sum with a window length of 2 observations.
Rolling sum with a window span of 2 seconds.
Rolling sum with forward looking windows with 2 observations.
min_periods
Rolling sum with a window length of 2 observations, but only needs a minimum of 1 observation to calculate a value.
center
Rolling sum with the result assigned to the center of the window index.
win_type
Rolling sum with a window length of 2, using the Scipy 'gaussian' window type. std is required in the aggregation function.


Round each value in a Series to the given number of decimals.
Number of decimal places to round to. If decimals is negative, it specifies the number of positions to the left of the decimal point.
Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy.
Rounded values of the Series.
See also
Round values of an np.array.
Round values of a DataFrame.
Examples


Return Exponential power of series and other, element-wise (binary operator rpow).
Equivalent to other ** series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Exponential power, see Python documentation for more details.
Examples


Return Subtraction of series and other, element-wise (binary operator rsub).
Equivalent to other - series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Subtraction, see Python documentation for more details.
Examples


Return Floating division of series and other, element-wise (binary operator rtruediv).
Equivalent to other / series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Floating division, see Python documentation for more details.
Examples


Return a random sample of items from an axis of object.
You can use random_state for reproducibility.
Number of items from axis to return. Cannot be used with frac. Default = 1 if frac = None.
Fraction of axis items to return. Cannot be used with n.
Allow or disallow sampling of the same row more than once.
Default ‘None’ results in equal probability weighting. If passed a Series, will align with target object on index. Index values in weights not found in sampled object will be ignored and index values in sampled object not in weights will be assigned weights of zero. If called on a DataFrame, will accept the name of a column when axis = 0. Unless weights are a Series, weights must be same length as axis being sampled. If weights do not sum to 1, they will be normalized to sum to 1. Missing values in the weights column will be treated as zero. Infinite values not allowed.
If int, array-like, or BitGenerator, seed for random number generator. If np.random.RandomState or np.random.Generator, use as given.
Changed in version 1.1.0: array-like and BitGenerator object now passed to np.random.RandomState() as seed
Changed in version 1.4.0: np.random.Generator objects now accepted
Axis to sample. Accepts axis number or name. Default is stat axis for given data type (0 for Series and DataFrames).
If True, the resulting index will be labeled 0, 1, …, n - 1.
New in version 1.3.0.
A new object of same type as caller containing n items randomly sampled from the caller object.
See also
Generates random samples from each group of a DataFrame object.
Generates random samples from each group of a Series object.
Generates a random sample from a given 1-D numpy array.
Notes
If frac > 1, replacement should be set to True.
Examples
Extract 3 random elements from the Series df['num_legs']: Note that we use random_state to ensure the reproducibility of the examples.
A random 50% sample of the DataFrame with replacement:
An upsample sample of the DataFrame with replacement: Note that replace parameter has to be True for frac parameter > 1.
Using a DataFrame column as weights. Rows with larger value in the num_specimen_seen column are more likely to be sampled.


Find indices where elements should be inserted to maintain order.
Find the indices into a sorted Series self such that, if the corresponding elements in value were inserted before the indices, the order of self would be preserved.
Note
The Series must be monotonically sorted, otherwise wrong locations will likely be returned. Pandas does not check this for you.
Values to insert into self.
If ‘left’, the index of the first suitable location found is given. If ‘right’, return the last such index. If there is no suitable index, return either 0 or N (where N is the length of self).
Optional array of integer indices that sort self into ascending order. They are typically the result of np.argsort.
A scalar or array of insertion points with the same shape as value.
See also
Sort by the values along either axis.
Similar method from NumPy.
Notes
Binary search is used to find the required insertion points.
Examples
If the values are not monotonically sorted, wrong locations may be returned:


Return unbiased standard error of the mean over requested axis.
Normalized by N-1 by default. This can be changed using the ddof argument
Exclude NA/null values. If an entire row/column is NA, the result will be NA.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.


Assign desired index to given axis.
Indexes for row labels can be changed by assigning a list-like or Index.
The values for the new index.
The axis to update. The value 0 identifies the rows.
Whether to return a new Series instance.
An object of type Series or None if inplace=True.
See also
Alter the name of the index.
Examples


Return a new object with updated flags.
Whether the returned object allows duplicate labels.
The same type as the caller.
See also
Global metadata applying to this dataset.
Global flags applying to this object.
Notes
This method returns a new object that’s a view on the same data as the input. Mutating the input or the output values will be reflected in the other.
This method is intended to be used in method chains.
“Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs.
Examples


Return a tuple of the shape of the underlying data.


Shift index by desired number of periods with an optional time freq.
When freq is not passed, shift the index without realigning the data. If freq is passed (in this case, the index must be date or datetime, or it will raise a NotImplementedError), the index will be increased using the periods and the freq. freq can be inferred when specified as “infer” as long as either freq or inferred_freq attribute is set in the index.
Number of periods to shift. Can be positive or negative.
Offset to use from the tseries module or time rule (e.g. ‘EOM’). If freq is specified then the index values are shifted but the data is not realigned. That is, use freq if you would like to extend the index when shifting and preserve the original data. If freq is specified as “infer” then it will be inferred from the freq or inferred_freq attributes of the index. If neither of those attributes exist, a ValueError is thrown.
Shift direction.
The scalar value to use for newly introduced missing values. the default depends on the dtype of self. For numeric data, np.nan is used. For datetime, timedelta, or period data, etc. NaT is used. For extension dtypes, self.dtype.na_value is used.
Changed in version 1.1.0.
Copy of input object, shifted.
See also
Shift values of Index.
Shift values of DatetimeIndex.
Shift values of PeriodIndex.
Shift the time index, using the index’s frequency if available.
Examples


Return the number of elements in the underlying data.


Return unbiased skew over requested axis.
Normalized by N-1.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.


Equivalent to shift without copying data. The shifted data will not include the dropped periods and the shifted axis will be smaller than the original.
Deprecated since version 1.2.0: slice_shift is deprecated, use DataFrame/Series.shift instead.
Number of periods to move, can be positive or negative.
Notes
While the slice_shift is faster than shift, you may pay for it later during alignment.


Sort Series by index labels.
Returns a new Series sorted by label if inplace argument is False, otherwise updates the original series and returns None.
Axis to direct sorting. This can only be 0 for Series.
If not None, sort on values in specified index level(s).
Sort ascending vs. descending. When the index is a MultiIndex the sort direction can be controlled for each level individually.
If True, perform operation in-place.
Choice of sorting algorithm. See also numpy.sort() for more information. ‘mergesort’ and ‘stable’ are the only stable algorithms. For DataFrames, this option is only applied when sorting on a single column or label.
If ‘first’ puts NaNs at the beginning, ‘last’ puts NaNs at the end. Not implemented for MultiIndex.
If True and sorting by level and index is multilevel, sort by other levels too (in order) after sorting by specified level.
If True, the resulting axis will be labeled 0, 1, …, n - 1.
New in version 1.0.0.
If not None, apply the key function to the index values before sorting. This is similar to the key argument in the builtin sorted() function, with the notable difference that this key function should be vectorized. It should expect an Index and return an Index of the same shape.
New in version 1.1.0.
The original Series sorted by the labels or None if inplace=True.
See also
Sort DataFrame by the index.
Sort DataFrame by the value.
Sort Series by the value.
Examples
Sort Descending
Sort Inplace
By default NaNs are put at the end, but use na_position to place them at the beginning
Specify index level to sort
Does not sort by remaining levels when sorting by levels
Apply a key function before sorting


Sort by the values.
Sort a Series in ascending or descending order by some criterion.
Axis to direct sorting. The value ‘index’ is accepted for compatibility with DataFrame.sort_values.
If True, sort values in ascending order, otherwise descending.
If True, perform operation in-place.
Choice of sorting algorithm. See also numpy.sort() for more information. ‘mergesort’ and ‘stable’ are the only stable algorithms.
Argument ‘first’ puts NaNs at the beginning, ‘last’ puts NaNs at the end.
If True, the resulting axis will be labeled 0, 1, …, n - 1.
New in version 1.0.0.
If not None, apply the key function to the series values before sorting. This is similar to the key argument in the builtin sorted() function, with the notable difference that this key function should be vectorized. It should expect a Series and return an array-like.
New in version 1.1.0.
Series ordered by values or None if inplace=True.
See also
Sort by the Series indices.
Sort DataFrame by the values along either axis.
Sort DataFrame by indices.
Examples
Sort values ascending order (default behaviour)
Sort values descending order
Sort values inplace
Sort values putting NAs first
Sort a series of strings
Sort using a key function. Your key function will be given the Series of values and should return an array-like.
NumPy ufuncs work well here. For example, we can sort by the sin of the value
More complicated user-defined functions can be used, as long as they expect a Series and return an array-like


Accessor for SparseSparse from other sparse matrix data types.


The percent of non- fill_value points, as decimal.
Examples


Elements in data that are fill_value are not stored.
For memory savings, this should be the most common value in the array.


Create a Series with sparse values from a scipy.sparse.coo_matrix.
If False (default), the SparseSeries index consists of only the coords of the non-null entries of the original coo_matrix. If True, the SparseSeries index consists of the full sorted (row, col) coordinates of the coo_matrix.
A Series with sparse values.
Examples


The number of non- fill_value points.
Examples


An ndarray containing the non- fill_value values.
Examples


Create a scipy.sparse.coo_matrix from a Series with MultiIndex.
Use row_levels and column_levels to determine the row and column coordinates respectively. row_levels and column_levels are the names (labels) or numbers of the levels. {row_levels, column_levels} must be a partition of the MultiIndex level names (or numbers).
Sort the row and column labels before forming the sparse matrix. When row_levels and/or column_levels refer to a single level, set to True for a faster execution.
Examples


Squeeze 1 dimensional axis objects into scalars.
Series or DataFrames with a single element are squeezed to a scalar. DataFrames with a single column or a single row are squeezed to a Series. Otherwise the object is unchanged.
This method is most useful when you don’t know if your object is a Series or DataFrame, but you do know it has just a single column. In that case you can safely call squeeze to ensure you have a Series.
A specific axis to squeeze. By default, all length-1 axes are squeezed.
The projection after squeezing axis or all the axes.
See also
Integer-location based indexing for selecting scalars.
Integer-location based indexing for selecting Series.
Inverse of DataFrame.squeeze for a single-column DataFrame.
Examples
Slicing might produce a Series with a single value:
Squeezing objects with more than one value in every axis does nothing:
Squeezing is even more effective when used with DataFrames.
Slicing a single column will produce a DataFrame with the columns having only one value:
So the columns can be squeezed down, resulting in a Series:
Slicing a single row from a single column will produce a single scalar DataFrame:
Squeezing the rows produces a single scalar Series:
Squeezing all axes will project directly into a scalar:


Return sample standard deviation over requested axis.
Normalized by N-1 by default. This can be changed using the ddof argument.
Exclude NA/null values. If an entire row/column is NA, the result will be NA.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Notes
To have the same behaviour as numpy.std, use ddof=0 (instead of the default ddof=1)
Examples
The standard deviation of the columns can be found as follows:
Alternatively, ddof=0 can be set to normalize by N instead of N-1:


Vectorized string functions for Series and Index.
NAs stay NA unless handled otherwise by a particular method. Patterned after Python’s string methods, with some inspiration from R’s stringr package.
Examples


Convert strings in the Series/Index to be capitalized.
Equivalent to str.capitalize().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Convert strings in the Series/Index to be casefolded.
New in version 0.25.0.
Equivalent to str.casefold().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Concatenate strings in the Series/Index with given separator.
If others is specified, this function concatenates the Series/Index and elements of others element-wise. If others is not passed, then all values in the Series/Index are concatenated into a single string with a given sep.
Series, Index, DataFrame, np.ndarray (one- or two-dimensional) and other list-likes of strings must have the same length as the calling Series/Index, with the exception of indexed objects (i.e. Series/Index/DataFrame) if join is not None.
If others is a list-like that contains a combination of Series, Index or np.ndarray (1-dim), then all elements will be unpacked and must satisfy the above criteria individually.
If others is None, the method returns the concatenation of all strings in the calling Series/Index.
The separator between the different elements/columns. By default the empty string ‘’ is used.
Representation that is inserted for all missing values:
If na_rep is None, and others is None, missing values in the Series/Index are omitted from the result.
If na_rep is None, and others is not None, a row containing a missing value in any of the columns (before concatenation) will have a missing value in the result.
Determines the join-style between the calling Series/Index and any Series/Index/DataFrame in others (objects without an index need to match the length of the calling Series/Index). To disable alignment, use .values on any Series/Index/DataFrame in others.
New in version 0.23.0.
Changed in version 1.0.0: Changed default of join from None to ‘left’.
If others is None, str is returned, otherwise a Series/Index (same type as caller) of objects is returned.
See also
Split each string in the Series/Index.
Join lists contained as elements in the Series/Index.
Examples
When not passing others, all values are concatenated into a single string:
By default, NA values in the Series are ignored. Using na_rep, they can be given a representation:
If others is specified, corresponding values are concatenated with the separator. Result will be a Series of strings.
Missing values will remain missing in the result, but can again be represented using na_rep
If sep is not specified, the values are concatenated without separation.
Series with different indexes can be aligned before concatenation. The join-keyword works as in other methods.
For more examples, see here.


Pad left and right side of strings in the Series/Index.
Equivalent to str.center().
Minimum width of resulting string; additional characters will be filled with fillchar.
Additional character for filling, default is whitespace.


Test if pattern or regex is contained within a string of a Series or Index.
Return boolean Series or Index based on whether a given pattern or regex is contained within a string of a Series or Index.
Character sequence or regular expression.
If True, case sensitive.
Flags to pass through to the re module, e.g. re.IGNORECASE.
Fill value for missing values. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.
If True, assumes the pat is a regular expression.
If False, treats the pat as a literal string.
A Series or Index of boolean values indicating whether the given pattern is contained within the string of each element of the Series or Index.
See also
Analogous, but stricter, relying on re.match instead of re.search.
Test if the start of each string element matches a pattern.
Same as startswith, but tests the end of string.
Examples
Returning a Series of booleans using only a literal pattern.
Returning an Index of booleans using only a literal pattern.
Specifying case sensitivity using case.
Specifying na to be False instead of NaN replaces NaN values with False. If Series or Index does not contain NaN values the resultant dtype will be bool, otherwise, an object dtype.
Returning ‘house’ or ‘dog’ when either expression occurs in a string.
Ignoring case sensitivity using flags with regex.
Returning any digit using regular expression.
Ensure pat is a not a literal pattern when regex is set to True. Note in the following example one might expect only s2[1] and s2[3] to return True. However, ‘.0’ as a regex matches any character followed by a 0.


Count occurrences of pattern in each string of the Series/Index.
This function is used to count the number of times a particular regex pattern is repeated in each of the string elements of the Series.
Valid regular expression.
Flags for the re module. For a complete list, see here.
For compatibility with other string methods. Not used.
Same type as the calling object containing the integer counts.
See also
Standard library module for regular expressions.
Standard library version, without regular expression support.
Notes
Some characters need to be escaped when passing in pat. eg. '$' has a special meaning in regex and must be escaped when finding this literal character.
Examples
Escape '$' to find the literal dollar sign.
This is also available on Index


Decode character string in the Series/Index using indicated encoding.
Equivalent to str.decode() in python2 and bytes.decode() in python3.


Encode character string in the Series/Index using indicated encoding.
Equivalent to str.encode().


Test if the end of each string element matches a pattern.
Equivalent to str.endswith().
Character sequence. Regular expressions are not accepted.
Object shown if element tested is not a string. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.
A Series of booleans indicating whether the given pattern matches the end of each string element.
See also
Python standard library string method.
Same as endswith, but tests the start of string.
Tests if string element contains a pattern.
Examples
Specifying na to be False instead of NaN.


Extract capture groups in the regex pat as columns in a DataFrame.
For each subject string in the Series, extract groups from the first match of regular expression pat.
Regular expression pattern with capturing groups.
Flags from the re module, e.g. re.IGNORECASE, that modify regular expression matching for things like case, spaces, etc. For more details, see re.
If True, return DataFrame with one column per capture group. If False, return a Series/Index if there is one capture group or DataFrame if there are multiple capture groups.
A DataFrame with one row for each subject string, and one column for each group. Any capture group names in regular expression pat will be used for column names; otherwise capture group numbers will be used. The dtype of each result column is always object, even when no match is found. If expand=False and pat has only one capture group, then return a Series (if subject is a Series) or Index (if subject is an Index).
See also
Returns all matches (not just the first match).
Examples
A pattern with two groups will return a DataFrame with two columns. Non-matches will be NaN.
A pattern may contain optional groups.
Named groups will become column names in the result.
A pattern with one group will return a DataFrame with one column if expand=True.
A pattern with one group will return a Series if expand=False.


Extract capture groups in the regex pat as columns in DataFrame.
For each subject string in the Series, extract groups from all matches of regular expression pat. When each subject string in the Series has exactly one match, extractall(pat).xs(0, level=’match’) is the same as extract(pat).
Regular expression pattern with capturing groups.
A re module flag, for example re.IGNORECASE. These allow to modify regular expression matching for things like case, spaces, etc. Multiple flags can be combined with the bitwise OR operator, for example re.IGNORECASE | re.MULTILINE.
A DataFrame with one row for each match, and one column for each group. Its rows have a MultiIndex with first levels that come from the subject Series. The last level is named ‘match’ and indexes the matches in each item of the Series. Any capture group names in regular expression pat will be used for column names; otherwise capture group numbers will be used.
See also
Returns first match only (not all matches).
Examples
A pattern with one group will return a DataFrame with one column. Indices with no matches will not appear in the result.
Capture group names are used for column names of the result.
A pattern with two groups will return a DataFrame with two columns.
Optional groups that do not match are NaN in the result.


Return lowest indexes in each strings in the Series/Index.
Each of returned indexes corresponds to the position where the substring is fully contained between [start:end]. Return -1 on failure. Equivalent to standard str.find().
Substring being searched.
Left edge index.
Right edge index.
See also
Return highest indexes in each strings.


Find all occurrences of pattern or regular expression in the Series/Index.
Equivalent to applying re.findall() to all the elements in the Series/Index.
Pattern or regular expression.
Flags from re module, e.g. re.IGNORECASE (default is 0, which means no flags).
All non-overlapping matches of pattern or regular expression in each string of this Series/Index.
See also
Count occurrences of pattern or regular expression in each string of the Series/Index.
For each string in the Series, extract groups from all matches of regular expression and return a DataFrame with one row for each match and one column for each group.
The equivalent re function to all non-overlapping matches of pattern or regular expression in string, as a list of strings.
Examples
The search for the pattern ‘Monkey’ returns one match:
On the other hand, the search for the pattern ‘MONKEY’ doesn’t return any match:
Flags can be added to the pattern or regular expression. For instance, to find the pattern ‘MONKEY’ ignoring the case:
When the pattern matches more than one string in the Series, all matches are returned:
Regular expressions are supported too. For instance, the search for all the strings ending with the word ‘on’ is shown next:
If the pattern is found more than once in the same string, then a list of multiple strings is returned:


Determine if each string entirely matches a regular expression.
New in version 1.1.0.
Character sequence or regular expression.
If True, case sensitive.
Regex module flags, e.g. re.IGNORECASE.
Fill value for missing values. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.
See also
Similar, but also returns True when only a prefix of the string matches the regular expression.
Extract matched groups.


Extract element from each component at specified position.
Extract element from lists, tuples, or strings in each element in the Series/Index.
Position of element to extract.
Examples


Return DataFrame of dummy/indicator variables for Series.
Each string in Series is split by sep and returned as a DataFrame of dummy/indicator variables.
String to split on.
Dummy variables corresponding to values of the Series.
See also
Convert categorical variable into dummy/indicator variables.
Examples


Return lowest indexes in each string in Series/Index.
Each of the returned indexes corresponds to the position where the substring is fully contained between [start:end]. This is the same as str.find except instead of returning -1, it raises a ValueError when the substring is not found. Equivalent to standard str.index.
Substring being searched.
Left edge index.
Right edge index.
See also
Return highest indexes in each strings.


Check whether all characters in each string are alphanumeric.
This is equivalent to running the Python string method str.isalnum() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are alphabetic.
This is equivalent to running the Python string method str.isalpha() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are decimal.
This is equivalent to running the Python string method str.isdecimal() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are digits.
This is equivalent to running the Python string method str.isdigit() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are lowercase.
This is equivalent to running the Python string method str.islower() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are numeric.
This is equivalent to running the Python string method str.isnumeric() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are whitespace.
This is equivalent to running the Python string method str.isspace() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are titlecase.
This is equivalent to running the Python string method str.istitle() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Check whether all characters in each string are uppercase.
This is equivalent to running the Python string method str.isupper() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Series or Index of boolean values with the same length as the original Series/Index.
See also
Check whether all characters are alphabetic.
Check whether all characters are numeric.
Check whether all characters are alphanumeric.
Check whether all characters are digits.
Check whether all characters are decimal.
Check whether all characters are whitespace.
Check whether all characters are lowercase.
Check whether all characters are uppercase.
Check whether all characters are titlecase.
Examples
Checks for Alphabetic and Numeric Characters
Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check.
More Detailed Checks for Numeric Characters
There are several different but overlapping sets of numeric characters that can be checked for.
The s3.str.isdecimal method checks for characters used to form numbers in base 10.
The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode.
The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions.
Checks for Whitespace
Checks for Character Case
The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.


Join lists contained as elements in the Series/Index with passed delimiter.
If the elements of a Series are lists themselves, join the content of these lists using the delimiter passed to the function. This function is an equivalent to str.join().
Delimiter to use between list entries.
The list entries concatenated by intervening occurrences of the delimiter.
If the supplied Series contains neither strings nor lists.
See also
Standard library version of this method.
Split strings around given separator/delimiter.
Notes
If any of the list items is not a string object, the result of the join will be NaN.
Examples
Example with a list that contains non-string elements.
Join all lists using a ‘-’. The lists containing object(s) of types other than str will produce a NaN.


Compute the length of each element in the Series/Index.
The element may be a sequence (such as a string, tuple or list) or a collection (such as a dictionary).
A Series or Index of integer values indicating the length of each element in the Series or Index.
See also
Python built-in function returning the length of an object.
Returns the length of the Series.
Examples
Returns the length (number of characters) in a string. Returns the number of entries for dictionaries, lists or tuples.


Pad right side of strings in the Series/Index.
Equivalent to str.ljust().
Minimum width of resulting string; additional characters will be filled with fillchar.
Additional character for filling, default is whitespace.


Convert strings in the Series/Index to lowercase.
Equivalent to str.lower().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Remove leading characters.
Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from left side. Equivalent to str.lstrip().
Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.
See also
Remove leading and trailing characters in Series/Index.
Remove leading characters in Series/Index.
Remove trailing characters in Series/Index.
Examples


Determine if each string starts with a match of a regular expression.
Character sequence or regular expression.
If True, case sensitive.
Regex module flags, e.g. re.IGNORECASE.
Fill value for missing values. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.
See also
Stricter matching that requires the entire string to match.
Analogous, but less strict, relying on re.search instead of re.match.
Extract matched groups.


Return the Unicode normal form for the strings in the Series/Index.
For more information on the forms, see the unicodedata.normalize().
Unicode form.


Pad strings in the Series/Index up to width.
Minimum width of resulting string; additional characters will be filled with character defined in fillchar.
Side from which to fill resulting string.
Additional character for filling, default is whitespace.
Returns Series or Index with minimum number of char in object.
See also
Fills the left side of strings with an arbitrary character. Equivalent to Series.str.pad(side='left').
Fills the right side of strings with an arbitrary character. Equivalent to Series.str.pad(side='right').
Fills both sides of strings with an arbitrary character. Equivalent to Series.str.pad(side='both').
Pad strings in the Series/Index by prepending ‘0’ character. Equivalent to Series.str.pad(side='left', fillchar='0').
Examples


Split the string at the first occurrence of sep.
This method splits the string at the first occurrence of sep, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing the string itself, followed by two empty strings.
String to split on.
If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index.
See also
Split the string at the last occurrence of sep.
Split strings around given separators.
Standard library version.
Examples
To partition by the last space instead of the first one:
To partition by something different than a space:
To return a Series containing tuples instead of a DataFrame:
Also available on indices:
Which will create a MultiIndex:
Or an index with tuples with expand=False:


Remove a prefix from an object series. If the prefix is not present, the original string will be returned.
Remove the prefix of the string.
The Series or Index with given prefix removed.
See also
Remove a suffix from an object series.
Examples


Remove a suffix from an object series. If the suffix is not present, the original string will be returned.
Remove the suffix of the string.
The Series or Index with given suffix removed.
See also
Remove a prefix from an object series.
Examples


Duplicate each string in the Series or Index.
Same value for all (int) or different value per (sequence).
Series or Index of repeated string objects specified by input parameter repeats.
Examples
Single int repeats string in Series
Sequence of int repeats corresponding string in Series


Replace each occurrence of pattern/regex in the Series/Index.
Equivalent to str.replace() or re.sub(), depending on the regex value.
String can be a character sequence or regular expression.
Replacement string or a callable. The callable is passed the regex match object and must return a replacement string to be used. See re.sub().
Number of replacements to make from start.
Determines if replace is case sensitive:
If True, case sensitive (the default if pat is a string)
Set to False for case insensitive
Cannot be set if pat is a compiled regex.
Regex module flags, e.g. re.IGNORECASE. Cannot be set if pat is a compiled regex.
Determines if the passed-in pattern is a regular expression:
If True, assumes the passed-in pattern is a regular expression.
If False, treats the pattern as a literal string
Cannot be set to False if pat is a compiled regex or repl is a callable.
New in version 0.23.0.
A copy of the object with all matching occurrences of pat replaced by repl.
if regex is False and repl is a callable or pat is a compiled regex
if pat is a compiled regex and case or flags is set
Notes
When pat is a compiled regex, all flags should be included in the compiled regex. Use of case, flags, or regex=False with a compiled regex will raise an error.
Examples
When pat is a string and regex is True (the default), the given pat is compiled as a regex. When repl is a string, it replaces matching regex patterns as with re.sub(). NaN value(s) in the Series are left as is:
When pat is a string and regex is False, every pat is replaced with repl as with str.replace():
When repl is a callable, it is called on every pat using re.sub(). The callable should expect one positional argument (a regex object) and return a string.
To get the idea:
Reverse every lowercase alphabetic word:
Using regex groups (extract second group and swap case):
Using a compiled regex with flags


Return highest indexes in each strings in the Series/Index.
Each of returned indexes corresponds to the position where the substring is fully contained between [start:end]. Return -1 on failure. Equivalent to standard str.rfind().
Substring being searched.
Left edge index.
Right edge index.
See also
Return lowest indexes in each strings.


Return highest indexes in each string in Series/Index.
Each of the returned indexes corresponds to the position where the substring is fully contained between [start:end]. This is the same as str.rfind except instead of returning -1, it raises a ValueError when the substring is not found. Equivalent to standard str.rindex.
Substring being searched.
Left edge index.
Right edge index.
See also
Return lowest indexes in each strings.


Pad left side of strings in the Series/Index.
Equivalent to str.rjust().
Minimum width of resulting string; additional characters will be filled with fillchar.
Additional character for filling, default is whitespace.


Split the string at the last occurrence of sep.
This method splits the string at the last occurrence of sep, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing two empty strings, followed by the string itself.
String to split on.
If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index.
See also
Split the string at the first occurrence of sep.
Split strings around given separators.
Standard library version.
Examples
To partition by the last space instead of the first one:
To partition by something different than a space:
To return a Series containing tuples instead of a DataFrame:
Also available on indices:
Which will create a MultiIndex:
Or an index with tuples with expand=False:


Split strings around given separator/delimiter.
Splits the string in the Series/Index from the end, at the specified delimiter string.
String or regular expression to split on. If not specified, split on whitespace.
Limit number of splits in output. None, 0 and -1 will be interpreted as return all splits.
Expand the split strings into separate columns.
If True, return DataFrame/MultiIndex expanding dimensionality.
If False, return Series/Index, containing lists of strings.
Determines if the passed-in pattern is a regular expression:
If True, assumes the passed-in pattern is a regular expression
If False, treats the pattern as a literal string.
If None and pat length is 1, treats pat as a literal string.
If None and pat length is not 1, treats pat as a regular expression.
Cannot be set to False if pat is a compiled regex
New in version 1.4.0.
Type matches caller unless expand=True (see Notes).
if regex is False and pat is a compiled regex
See also
Split strings around given separator/delimiter.
Splits string around given separator/delimiter, starting from the right.
Join lists contained as elements in the Series/Index with passed delimiter.
Standard library version for split.
Standard library version for rsplit.
Notes
The handling of the n keyword depends on the number of found splits:
If found splits > n, make first n splits only
If found splits <= n, make all splits
If for a certain row the number of found splits < n, append None for padding up to n if expand=True
If using expand=True, Series and Index callers return DataFrame and MultiIndex objects, respectively.
Use of regex=False with a pat as a compiled regex will raise an error.
Examples
In the default setting, the string is split by whitespace.
Without the n parameter, the outputs of rsplit and split are identical.
The n parameter can be used to limit the number of splits on the delimiter. The outputs of split and rsplit are different.
The pat parameter can be used to split by other characters.
When using expand=True, the split elements will expand out into separate columns. If NaN is present, it is propagated throughout the columns during the split.
For slightly more complex use cases like splitting the html document name from a url, a combination of parameter settings can be used.
Remember to escape special characters when explicitly using regular expressions.
Regular expressions can be used to handle urls or file names. When pat is a string and regex=None (the default), the given pat is compiled as a regex only if len(pat) != 1.
When regex=True, pat is interpreted as a regex
A compiled regex can be passed as pat
When regex=False, pat is interpreted as the string itself


Remove trailing characters.
Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from right side. Equivalent to str.rstrip().
Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.
See also
Remove leading and trailing characters in Series/Index.
Remove leading characters in Series/Index.
Remove trailing characters in Series/Index.
Examples


Slice substrings from each element in the Series or Index.
Start position for slice operation.
Stop position for slice operation.
Step size for slice operation.
Series or Index from sliced substring from original string object.
See also
Replace a slice with a string.
Return element at position. Equivalent to Series.str.slice(start=i, stop=i+1) with i being the position.
Examples
Equivalent behaviour to:


Replace a positional slice of a string with another value.
Left index position to use for the slice. If not specified (None), the slice is unbounded on the left, i.e. slice from the start of the string.
Right index position to use for the slice. If not specified (None), the slice is unbounded on the right, i.e. slice until the end of the string.
String for replacement. If not specified (None), the sliced region is replaced with an empty string.
Same type as the original object.
See also
Just slicing without replacement.
Examples
Specify just start, meaning replace start until the end of the string with repl.
Specify just stop, meaning the start of the string to stop is replaced with repl, and the rest of the string is included.
Specify start and stop, meaning the slice from start to stop is replaced with repl. Everything before or after start and stop is included as is.


Split strings around given separator/delimiter.
Splits the string in the Series/Index from the beginning, at the specified delimiter string.
String or regular expression to split on. If not specified, split on whitespace.
Limit number of splits in output. None, 0 and -1 will be interpreted as return all splits.
Expand the split strings into separate columns.
If True, return DataFrame/MultiIndex expanding dimensionality.
If False, return Series/Index, containing lists of strings.
Determines if the passed-in pattern is a regular expression:
If True, assumes the passed-in pattern is a regular expression
If False, treats the pattern as a literal string.
If None and pat length is 1, treats pat as a literal string.
If None and pat length is not 1, treats pat as a regular expression.
Cannot be set to False if pat is a compiled regex
New in version 1.4.0.
Type matches caller unless expand=True (see Notes).
if regex is False and pat is a compiled regex
See also
Split strings around given separator/delimiter.
Splits string around given separator/delimiter, starting from the right.
Join lists contained as elements in the Series/Index with passed delimiter.
Standard library version for split.
Standard library version for rsplit.
Notes
The handling of the n keyword depends on the number of found splits:
If found splits > n, make first n splits only
If found splits <= n, make all splits
If for a certain row the number of found splits < n, append None for padding up to n if expand=True
If using expand=True, Series and Index callers return DataFrame and MultiIndex objects, respectively.
Use of regex=False with a pat as a compiled regex will raise an error.
Examples
In the default setting, the string is split by whitespace.
Without the n parameter, the outputs of rsplit and split are identical.
The n parameter can be used to limit the number of splits on the delimiter. The outputs of split and rsplit are different.
The pat parameter can be used to split by other characters.
When using expand=True, the split elements will expand out into separate columns. If NaN is present, it is propagated throughout the columns during the split.
For slightly more complex use cases like splitting the html document name from a url, a combination of parameter settings can be used.
Remember to escape special characters when explicitly using regular expressions.
Regular expressions can be used to handle urls or file names. When pat is a string and regex=None (the default), the given pat is compiled as a regex only if len(pat) != 1.
When regex=True, pat is interpreted as a regex
A compiled regex can be passed as pat
When regex=False, pat is interpreted as the string itself


Test if the start of each string element matches a pattern.
Equivalent to str.startswith().
Character sequence. Regular expressions are not accepted.
Object shown if element tested is not a string. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.
A Series of booleans indicating whether the given pattern matches the start of each string element.
See also
Python standard library string method.
Same as startswith, but tests the end of string.
Tests if string element contains a pattern.
Examples
Specifying na to be False instead of NaN.


Remove leading and trailing characters.
Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from left and right sides. Equivalent to str.strip().
Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.
See also
Remove leading and trailing characters in Series/Index.
Remove leading characters in Series/Index.
Remove trailing characters in Series/Index.
Examples


Convert strings in the Series/Index to be swapcased.
Equivalent to str.swapcase().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Convert strings in the Series/Index to titlecase.
Equivalent to str.title().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Map all characters in the string through the given mapping table.
Equivalent to standard str.translate().
Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or None. Unmapped characters are left untouched. Characters mapped to None are deleted. str.maketrans() is a helper function for making translation tables.


Convert strings in the Series/Index to uppercase.
Equivalent to str.upper().
See also
Converts all characters to lowercase.
Converts all characters to uppercase.
Converts first character of each word to uppercase and remaining to lowercase.
Converts first character to uppercase and remaining to lowercase.
Converts uppercase to lowercase and lowercase to uppercase.
Removes all case distinctions in the string.
Examples


Wrap strings in Series/Index at specified line width.
This method has the same keyword parameters and defaults as textwrap.TextWrapper.
Maximum line width.
If True, tab characters will be expanded to spaces (default: True).
If True, each whitespace character (as defined by string.whitespace) remaining after tab expansion will be replaced by a single space (default: True).
If True, whitespace that, after wrapping, happens to end up at the beginning or end of a line is dropped (default: True).
If True, then words longer than width will be broken in order to ensure that no lines are longer than width. If it is false, long words will not be broken, and some lines may be longer than width (default: True).
If True, wrapping will occur preferably on whitespace and right after hyphens in compound words, as it is customary in English. If false, only whitespaces will be considered as potentially good places for line breaks, but you need to set break_long_words to false if you want truly insecable words (default: True).
Notes
Internally, this method uses a textwrap.TextWrapper instance with default settings. To achieve behavior matching R’s stringr library str_wrap function, use the arguments:
expand_tabs = False
replace_whitespace = True
drop_whitespace = True
break_long_words = False
break_on_hyphens = False
Examples


Pad strings in the Series/Index by prepending ‘0’ characters.
Strings in the Series/Index are padded with ‘0’ characters on the left of the string to reach a total string length width. Strings in the Series/Index with length greater or equal to width are unchanged.
Minimum length of resulting string; strings with length less than width be prepended with ‘0’ characters.
See also
Fills the left side of strings with an arbitrary character.
Fills the right side of strings with an arbitrary character.
Fills the specified sides of strings with an arbitrary character.
Fills both sides of strings with an arbitrary character.
Notes
Differs from str.zfill() which has special handling for ‘+’/’-’ in the string.
Examples
Note that 10 and NaN are not strings, therefore they are converted to NaN. The minus sign in '-1' is treated as a regular character and the zero is added to the left of it (str.zfill() would have moved it to the left). 1000 remains unchanged as it is longer than width.


Return Subtraction of series and other, element-wise (binary operator sub).
Equivalent to series - other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Reverse of the Subtraction operator, see Python documentation for more details.
Examples


Return the sum of the values over the requested axis.
This is equivalent to the method numpy.sum.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
The required number of valid values to perform the operation. If fewer than min_count non-NA values are present the result will be NA.
Additional keyword arguments to be passed to the function.
See also
Return the sum.
Return the minimum.
Return the maximum.
Return the index of the minimum.
Return the index of the maximum.
Return the sum over the requested axis.
Return the minimum over the requested axis.
Return the maximum over the requested axis.
Return the index of the minimum over the requested axis.
Return the index of the maximum over the requested axis.
Examples
By default, the sum of an empty or all-NA Series is 0.
This can be controlled with the min_count parameter. For example, if you’d like the sum of an empty series to be NaN, pass min_count=1.
Thanks to the skipna parameter, min_count handles all-NA and empty series identically.


Interchange axes and swap values axes appropriately.


Swap levels i and j in a MultiIndex.
Default is to swap the two innermost levels of the index.
Levels of the indices to be swapped. Can pass level name as string.
Whether to copy underlying data.
Series with levels swapped in MultiIndex.
Examples
In the following example, we will swap the levels of the indices. Here, we will swap the levels column-wise, but levels can be swapped row-wise in a similar manner. Note that column-wise is the default behaviour. By not supplying any arguments for i and j, we swap the last and second to last indices.
By supplying one argument, we can choose which index to swap the last index with. We can for example swap the first index with the last one as follows.
We can also define explicitly which indices we want to swap by supplying values for both i and j. Here, we for example swap the first and second indices.


Return the transpose, which is by definition self.


Return the last n rows.
This function returns last n rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows.
For negative values of n, this function returns all rows except the first n rows, equivalent to df[n:].
Number of rows to select.
The last n rows of the caller object.
See also
The first n rows of the caller object.
Examples
Viewing the last 5 lines
Viewing the last n lines (three in this case)
For negative values of n


Return the elements in the given positional indices along an axis.
This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object.
An array of ints indicating which positions to take.
The axis on which to select elements. 0 means that we are selecting rows, 1 means that we are selecting columns.
Before pandas 1.0, is_copy=False can be specified to ensure that the return value is an actual copy. Starting with pandas 1.0, take always returns a copy, and the keyword is therefore deprecated.
Deprecated since version 1.0.0.
For compatibility with numpy.take(). Has no effect on the output.
An array-like containing the elements taken from the object.
See also
Select a subset of a DataFrame by labels.
Select a subset of a DataFrame by positions.
Take elements from an array along an axis.
Examples
Take elements at positions 0 and 3 along the axis 0 (default).
Note how the actual indices selected (0 and 1) do not correspond to our selected indices 0 and 3. That’s because we are selecting the 0th and 3rd rows, not rows whose indices equal 0 and 3.
Take elements at indices 1 and 2 along the axis 1 (column selection).
We may take elements using negative integers for positive indices, starting from the end of the object, just like with Python lists.


Copy object to the system clipboard.
Write a text representation of object to the system clipboard. This can be pasted into Excel, for example.
Produce output in a csv format for easy pasting into excel.
True, use the provided separator for csv pasting.
False, write a string representation of the object to the clipboard.
Field delimiter.
These parameters will be passed to DataFrame.to_csv.
See also
Write a DataFrame to a comma-separated values (csv) file.
Read text from clipboard and pass to read_csv.
Notes
Requirements for your platform.
Linux : xclip, or xsel (with PyQt4 modules)
Windows : none
macOS : none
Examples
Copy the contents of a DataFrame to the clipboard.
We can omit the index by passing the keyword index and setting it to false.


Write object to a comma-separated values (csv) file.
String, path object (implementing os.PathLike[str]), or file-like object implementing a write() function. If None, the result is returned as a string. If a non-binary file object is passed, it should be opened with newline=’’, disabling universal newlines. If a binary file object is passed, mode might need to contain a ‘b’.
Changed in version 1.2.0: Support for binary file objects was introduced.
String of length 1. Field delimiter for the output file.
Missing data representation.
Format string for floating point numbers.
Columns to write.
Write out the column names. If a list of strings is given it is assumed to be aliases for the column names.
Write row names (index).
Column label for index column(s) if desired. If None is given, and header and index are True, then the index names are used. A sequence should be given if the object uses MultiIndex. If False do not print fields for index names. Use index_label=False for easier importing in R.
Python write mode, default ‘w’.
A string representing the encoding to use in the output file, defaults to ‘utf-8’. encoding is not supported if path_or_buf is a non-binary file object.
For on-the-fly compression of the output data. If ‘infer’ and ‘%s’ path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, ‘.xz’, or ‘.zst’ (otherwise no compression). Set to None for no compression. Can also be a dict with key 'method' set to one of {'zip', 'gzip', 'bz2', 'zstd'} and other key-value pairs are forwarded to zipfile.ZipFile, gzip.GzipFile, bz2.BZ2File, or zstandard.ZstdDecompressor, respectively. As an example, the following could be passed for faster compression and to create a reproducible gzip archive: compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}.
Changed in version 1.0.0: May now be a dict with key ‘method’ as compression mode and other entries as additional compression options if compression mode is ‘zip’.
Changed in version 1.1.0: Passing compression options as keys in dict is supported for compression modes ‘gzip’, ‘bz2’, ‘zstd’, and ‘zip’.
Changed in version 1.2.0: Compression is supported for binary file objects.
Changed in version 1.2.0: Previous versions forwarded dict entries for ‘gzip’ to gzip.open instead of gzip.GzipFile which prevented setting mtime.
Defaults to csv.QUOTE_MINIMAL. If you have set a float_format then floats are converted to strings and thus csv.QUOTE_NONNUMERIC will treat them as non-numeric.
String of length 1. Character used to quote fields.
The newline character or character sequence to use in the output file. Defaults to os.linesep, which depends on the OS in which this method is called (’\n’ for linux, ‘\r\n’ for Windows, i.e.).
Rows to write at a time.
Format string for datetime objects.
Control quoting of quotechar inside a field.
String of length 1. Character used to escape sep and quotechar when appropriate.
Character recognized as decimal separator. E.g. use ‘,’ for European data.
Specifies how encoding and decoding errors are to be handled. See the errors argument for open() for a full list of options.
New in version 1.1.0.
Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.
New in version 1.2.0.
If path_or_buf is None, returns the resulting csv format as a string. Otherwise returns None.
See also
Load a CSV file into a DataFrame.
Write DataFrame to an Excel file.
Examples
Create ‘out.zip’ containing ‘out.csv’
To write a csv file to a new folder or nested folder you will first need to create it using either Pathlib or os:


Convert Series to {label -> value} dict or dict-like object.
The collections.abc.Mapping subclass to use as the return object. Can be the actual class or an empty instance of the mapping type you want. If you want a collections.defaultdict, you must pass it initialized.
Key-value representation of Series.
Examples


Write object to an Excel sheet.
To write a single object to an Excel .xlsx file it is only necessary to specify a target file name. To write to multiple sheets it is necessary to create an ExcelWriter object with a target file name, and specify a sheet in the file to write to.
Multiple sheets may be written to by specifying unique sheet_name. With all data written to the file it is necessary to save the changes. Note that creating an ExcelWriter object with a file name that already exists will result in the contents of the existing file being erased.
File path or existing ExcelWriter.
Name of sheet which will contain DataFrame.
Missing data representation.
Format string for floating point numbers. For example float_format="%.2f" will format 0.1234 to 0.12.
Columns to write.
Write out the column names. If a list of string is given it is assumed to be aliases for the column names.
Write row names (index).
Column label for index column(s) if desired. If not specified, and header and index are True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.
Upper left cell row to dump data frame.
Upper left cell column to dump data frame.
Write engine to use, ‘openpyxl’ or ‘xlsxwriter’. You can also set this via the options io.excel.xlsx.writer, io.excel.xls.writer, and io.excel.xlsm.writer.
Deprecated since version 1.2.0: As the xlwt package is no longer maintained, the xlwt engine will be removed in a future version of pandas.
Write MultiIndex and Hierarchical Rows as merged cells.
Encoding of the resulting excel file. Only necessary for xlwt, other writers support unicode natively.
Representation for infinity (there is no native representation for infinity in Excel).
Display more information in the error logs.
Specifies the one-based bottommost row and rightmost column that is to be frozen.
Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.
New in version 1.2.0.
See also
Write DataFrame to a comma-separated values (csv) file.
Class for writing DataFrame objects into excel sheets.
Read an Excel file into a pandas DataFrame.
Read a comma-separated values (csv) file into DataFrame.
Notes
For compatibility with to_csv(), to_excel serializes lists and dicts to strings before writing.
Once a workbook has been saved it is not possible to write further data without rewriting the whole workbook.
Examples
Create, write to and save a workbook:
To specify the sheet name:
If you wish to write to more than one sheet in the workbook, it is necessary to specify an ExcelWriter object:
ExcelWriter can also be used to append to an existing Excel file:
To set the library that is used to write the Excel file, you can pass the engine keyword (the default engine is automatically chosen depending on the file extension):


Convert Series to DataFrame.
The passed name should substitute for the series name (if it has one).
DataFrame representation of Series.
Examples


Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an application to interpret the structure and contents of a file with no outside information. One HDF file can hold a mix of related objects which can be accessed as a group or as individual objects.
In order to add another DataFrame or Series to an existing HDF file please use append mode and a different a key.
Warning
One can store a subclass of DataFrame or Series to HDF5, but the type of the subclass is lost upon storing.
For more information see the user guide.
File path or HDFStore object.
Identifier for the group in the store.
Mode to open file:
‘w’: write, a new file is created (an existing file with the same name would be deleted).
‘a’: append, an existing file is opened for reading and writing, and if the file does not exist it is created.
‘r+’: similar to ‘a’, but the file must already exist.
Specifies a compression level for data. A value of 0 or None disables compression.
Specifies the compression library to be used. As of v0.20.2 these additional compressors for Blosc are supported (default if no compressor specified: ‘blosc:blosclz’): {‘blosc:blosclz’, ‘blosc:lz4’, ‘blosc:lz4hc’, ‘blosc:snappy’, ‘blosc:zlib’, ‘blosc:zstd’}. Specifying a compression library which is not available issues a ValueError.
For Table formats, append the input data to the existing.
Possible values:
‘fixed’: Fixed format. Fast writing/reading. Not-appendable, nor searchable.
‘table’: Table format. Write as a PyTables Table structure which may perform worse but allow more flexible operations like searching / selecting subsets of the data.
If None, pd.get_option(‘io.hdf.default_format’) is checked, followed by fallback to “fixed”.
Specifies how encoding and decoding errors are to be handled. See the errors argument for open() for a full list of options.
Map column names to minimum string sizes for columns.
How to represent null values as str. Not allowed with append=True.
List of columns to create as indexed data columns for on-disk queries, or True to use all columns. By default only the axes of the object are indexed. See Query via data columns. Applicable only to format=’table’.
See also
Read from HDF file.
Write a DataFrame to the binary parquet format.
Write to a SQL table.
Write out feather-format for DataFrames.
Write out to a csv file.
Examples
We can add another object to the same file:
Reading from HDF file: