DataFrame([data, index, columns, dtype, copy])
DataFrame
Two-dimensional, size-mutable, potentially heterogeneous tabular data.
Axes
DataFrame.index
The index (row labels) of the DataFrame.
DataFrame.columns
The column labels of the DataFrame.
DataFrame.dtypes
Return the dtypes in the DataFrame.
DataFrame.select_dtypes(self[, include, exclude])
DataFrame.select_dtypes
Return a subset of the DataFrame’s columns based on the column dtypes.
DataFrame.values
Return a Numpy representation of the DataFrame.
DataFrame.axes
Return a list representing the axes of the DataFrame.
DataFrame.ndim
Return an int representing the number of axes / array dimensions.
DataFrame.size
Return an int representing the number of elements in this object.
DataFrame.shape
Return a tuple representing the dimensionality of the DataFrame.
DataFrame.memory_usage(self[, index, deep])
DataFrame.memory_usage
Return the memory usage of each column in bytes.
DataFrame.empty
Indicator whether DataFrame is empty.
DataFrame.astype(self, dtype, copy, errors)
DataFrame.astype
Cast a pandas object to a specified dtype dtype.
dtype
DataFrame.infer_objects(self)
DataFrame.infer_objects
Attempt to infer better dtypes for object columns.
DataFrame.copy(self, deep)
DataFrame.copy
Make a copy of this object’s indices and data.
DataFrame.isna(self)
DataFrame.isna
Detect missing values.
DataFrame.notna(self)
DataFrame.notna
Detect existing (non-missing) values.
DataFrame.bool(self)
DataFrame.bool
Return the bool of a single element PandasObject.
DataFrame.head(self, n)
DataFrame.head
Return the first n rows.
DataFrame.at
Access a single value for a row/column label pair.
DataFrame.iat
Access a single value for a row/column pair by integer position.
DataFrame.loc
Access a group of rows and columns by label(s) or a boolean array.
DataFrame.iloc
Purely integer-location based indexing for selection by position.
DataFrame.insert(self, loc, column, value[, …])
DataFrame.insert
Insert column into DataFrame at specified location.
DataFrame.__iter__(self)
DataFrame.__iter__
Iterate over info axis.
DataFrame.items(self)
DataFrame.items
Iterate over (column name, Series) pairs.
DataFrame.iteritems(self)
DataFrame.iteritems
DataFrame.keys(self)
DataFrame.keys
Get the ‘info axis’ (see Indexing for more).
DataFrame.iterrows(self)
DataFrame.iterrows
Iterate over DataFrame rows as (index, Series) pairs.
DataFrame.itertuples(self[, index, name])
DataFrame.itertuples
Iterate over DataFrame rows as namedtuples.
DataFrame.lookup(self, row_labels, col_labels)
DataFrame.lookup
Label-based “fancy indexing” function for DataFrame.
DataFrame.pop(self, item)
DataFrame.pop
Return item and drop from frame.
DataFrame.tail(self, n)
DataFrame.tail
Return the last n rows.
DataFrame.xs(self, key[, axis, level])
DataFrame.xs
Return cross-section from the Series/DataFrame.
DataFrame.get(self, key[, default])
DataFrame.get
Get item from object for given key (ex: DataFrame column).
DataFrame.isin(self, values)
DataFrame.isin
Whether each element in the DataFrame is contained in values.
DataFrame.where(self, cond[, other, …])
DataFrame.where
Replace values where the condition is False.
DataFrame.mask(self, cond[, other, inplace, …])
DataFrame.mask
Replace values where the condition is True.
DataFrame.query(self, expr[, inplace])
DataFrame.query
Query the columns of a DataFrame with a boolean expression.
For more information on .at, .iat, .loc, and .iloc, see the indexing documentation.
.at
.iat
.loc
.iloc
DataFrame.add(self, other[, axis, level, …])
DataFrame.add
Get Addition of dataframe and other, element-wise (binary operator add).
DataFrame.sub(self, other[, axis, level, …])
DataFrame.sub
Get Subtraction of dataframe and other, element-wise (binary operator sub).
DataFrame.mul(self, other[, axis, level, …])
DataFrame.mul
Get Multiplication of dataframe and other, element-wise (binary operator mul).
DataFrame.div(self, other[, axis, level, …])
DataFrame.div
Get Floating division of dataframe and other, element-wise (binary operator truediv).
DataFrame.truediv(self, other[, axis, …])
DataFrame.truediv
DataFrame.floordiv(self, other[, axis, …])
DataFrame.floordiv
Get Integer division of dataframe and other, element-wise (binary operator floordiv).
DataFrame.mod(self, other[, axis, level, …])
DataFrame.mod
Get Modulo of dataframe and other, element-wise (binary operator mod).
DataFrame.pow(self, other[, axis, level, …])
DataFrame.pow
Get Exponential power of dataframe and other, element-wise (binary operator pow).
DataFrame.dot(self, other)
DataFrame.dot
Compute the matrix multiplication between the DataFrame and other.
DataFrame.radd(self, other[, axis, level, …])
DataFrame.radd
Get Addition of dataframe and other, element-wise (binary operator radd).
DataFrame.rsub(self, other[, axis, level, …])
DataFrame.rsub
Get Subtraction of dataframe and other, element-wise (binary operator rsub).
DataFrame.rmul(self, other[, axis, level, …])
DataFrame.rmul
Get Multiplication of dataframe and other, element-wise (binary operator rmul).
DataFrame.rdiv(self, other[, axis, level, …])
DataFrame.rdiv
Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
DataFrame.rtruediv(self, other[, axis, …])
DataFrame.rtruediv
DataFrame.rfloordiv(self, other[, axis, …])
DataFrame.rfloordiv
Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).
DataFrame.rmod(self, other[, axis, level, …])
DataFrame.rmod
Get Modulo of dataframe and other, element-wise (binary operator rmod).
DataFrame.rpow(self, other[, axis, level, …])
DataFrame.rpow
Get Exponential power of dataframe and other, element-wise (binary operator rpow).
DataFrame.lt(self, other[, axis, level])
DataFrame.lt
Get Less than of dataframe and other, element-wise (binary operator lt).
DataFrame.gt(self, other[, axis, level])
DataFrame.gt
Get Greater than of dataframe and other, element-wise (binary operator gt).
DataFrame.le(self, other[, axis, level])
DataFrame.le
Get Less than or equal to of dataframe and other, element-wise (binary operator le).
DataFrame.ge(self, other[, axis, level])
DataFrame.ge
Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).
DataFrame.ne(self, other[, axis, level])
DataFrame.ne
Get Not equal to of dataframe and other, element-wise (binary operator ne).
DataFrame.eq(self, other[, axis, level])
DataFrame.eq
Get Equal to of dataframe and other, element-wise (binary operator eq).
DataFrame.combine(self, other, func[, …])
DataFrame.combine
Perform column-wise combine with another DataFrame.
DataFrame.combine_first(self, other)
DataFrame.combine_first
Update null elements with value in the same location in other.
DataFrame.apply(self, func[, axis, raw, …])
DataFrame.apply
Apply a function along an axis of the DataFrame.
DataFrame.applymap(self, func)
DataFrame.applymap
Apply a function to a Dataframe elementwise.
DataFrame.pipe(self, func, \*args, \*\*kwargs)
DataFrame.pipe
Apply func(self, *args, **kwargs).
DataFrame.agg(self, func[, axis])
DataFrame.agg
Aggregate using one or more operations over the specified axis.
DataFrame.aggregate(self, func[, axis])
DataFrame.aggregate
DataFrame.transform(self, func[, axis])
DataFrame.transform
Call func on self producing a DataFrame with transformed values.
func
DataFrame.groupby(self[, by, axis, level])
DataFrame.groupby
Group DataFrame using a mapper or by a Series of columns.
DataFrame.rolling(self, window[, …])
DataFrame.rolling
Provide rolling window calculations.
DataFrame.expanding(self[, min_periods, …])
DataFrame.expanding
Provide expanding transformations.
DataFrame.ewm(self[, com, span, halflife, …])
DataFrame.ewm
Provide exponential weighted functions.
DataFrame.abs(self)
DataFrame.abs
Return a Series/DataFrame with absolute numeric value of each element.
DataFrame.all(self[, axis, bool_only, …])
DataFrame.all
Return whether all elements are True, potentially over an axis.
DataFrame.any(self[, axis, bool_only, …])
DataFrame.any
Return whether any element is True, potentially over an axis.
DataFrame.clip(self[, lower, upper, axis])
DataFrame.clip
Trim values at input threshold(s).
DataFrame.corr(self[, method, min_periods])
DataFrame.corr
Compute pairwise correlation of columns, excluding NA/null values.
DataFrame.corrwith(self, other[, axis, …])
DataFrame.corrwith
Compute pairwise correlation.
DataFrame.count(self[, axis, level, …])
DataFrame.count
Count non-NA cells for each column or row.
DataFrame.cov(self[, min_periods])
DataFrame.cov
Compute pairwise covariance of columns, excluding NA/null values.
DataFrame.cummax(self[, axis, skipna])
DataFrame.cummax
Return cumulative maximum over a DataFrame or Series axis.
DataFrame.cummin(self[, axis, skipna])
DataFrame.cummin
Return cumulative minimum over a DataFrame or Series axis.
DataFrame.cumprod(self[, axis, skipna])
DataFrame.cumprod
Return cumulative product over a DataFrame or Series axis.
DataFrame.cumsum(self[, axis, skipna])
DataFrame.cumsum
Return cumulative sum over a DataFrame or Series axis.
DataFrame.describe(self[, percentiles, …])
DataFrame.describe
Generate descriptive statistics.
DataFrame.diff(self[, periods, axis])
DataFrame.diff
First discrete difference of element.
DataFrame.eval(self, expr[, inplace])
DataFrame.eval
Evaluate a string describing operations on DataFrame columns.
DataFrame.kurt(self[, axis, skipna, level, …])
DataFrame.kurt
Return unbiased kurtosis over requested axis.
DataFrame.kurtosis(self[, axis, skipna, …])
DataFrame.kurtosis
DataFrame.mad(self[, axis, skipna, level])
DataFrame.mad
Return the mean absolute deviation of the values for the requested axis.
DataFrame.max(self[, axis, skipna, level, …])
DataFrame.max
Return the maximum of the values for the requested axis.
DataFrame.mean(self[, axis, skipna, level, …])
DataFrame.mean
Return the mean of the values for the requested axis.
DataFrame.median(self[, axis, skipna, …])
DataFrame.median
Return the median of the values for the requested axis.
DataFrame.min(self[, axis, skipna, level, …])
DataFrame.min
Return the minimum of the values for the requested axis.
DataFrame.mode(self[, axis, numeric_only, …])
DataFrame.mode
Get the mode(s) of each element along the selected axis.
DataFrame.pct_change(self[, periods, …])
DataFrame.pct_change
Percentage change between the current and a prior element.
DataFrame.prod(self[, axis, skipna, level, …])
DataFrame.prod
Return the product of the values for the requested axis.
DataFrame.product(self[, axis, skipna, …])
DataFrame.product
DataFrame.quantile(self[, q, axis, …])
DataFrame.quantile
Return values at the given quantile over requested axis.
DataFrame.rank(self[, axis])
DataFrame.rank
Compute numerical data ranks (1 through n) along axis.
DataFrame.round(self[, decimals])
DataFrame.round
Round a DataFrame to a variable number of decimal places.
DataFrame.sem(self[, axis, skipna, level, …])
DataFrame.sem
Return unbiased standard error of the mean over requested axis.
DataFrame.skew(self[, axis, skipna, level, …])
DataFrame.skew
Return unbiased skew over requested axis.
DataFrame.sum(self[, axis, skipna, level, …])
DataFrame.sum
Return the sum of the values for the requested axis.
DataFrame.std(self[, axis, skipna, level, …])
DataFrame.std
Return sample standard deviation over requested axis.
DataFrame.var(self[, axis, skipna, level, …])
DataFrame.var
Return unbiased variance over requested axis.
DataFrame.nunique(self[, axis, dropna])
DataFrame.nunique
Count distinct observations over requested axis.
DataFrame.add_prefix(self, prefix)
DataFrame.add_prefix
Prefix labels with string prefix.
DataFrame.add_suffix(self, suffix)
DataFrame.add_suffix
Suffix labels with string suffix.
DataFrame.align(self, other[, join, axis, …])
DataFrame.align
Align two objects on their axes with the specified join method.
DataFrame.at_time(self, time, asof[, axis])
DataFrame.at_time
Select values at particular time of day (e.g.
DataFrame.between_time(self, start_time, …)
DataFrame.between_time
Select values between particular times of the day (e.g., 9:00-9:30 AM).
DataFrame.drop(self[, labels, axis, index, …])
DataFrame.drop
Drop specified labels from rows or columns.
DataFrame.drop_duplicates(self, subset, …)
DataFrame.drop_duplicates
Return DataFrame with duplicate rows removed.
DataFrame.duplicated(self, subset, …)
DataFrame.duplicated
Return boolean Series denoting duplicate rows.
DataFrame.equals(self, other)
DataFrame.equals
Test whether two objects contain the same elements.
DataFrame.filter(self[, items, axis])
DataFrame.filter
Subset the dataframe rows or columns according to the specified index labels.
DataFrame.first(self, offset)
DataFrame.first
Method to subset initial periods of time series data based on a date offset.
DataFrame.idxmax(self[, axis, skipna])
DataFrame.idxmax
Return index of first occurrence of maximum over requested axis.
DataFrame.idxmin(self[, axis, skipna])
DataFrame.idxmin
Return index of first occurrence of minimum over requested axis.
DataFrame.last(self, offset)
DataFrame.last
Method to subset final periods of time series data based on a date offset.
DataFrame.reindex(self[, labels, index, …])
DataFrame.reindex
Conform DataFrame to new index with optional filling logic.
DataFrame.reindex_like(self, other, method, …)
DataFrame.reindex_like
Return an object with matching indices as other object.
DataFrame.rename(self[, mapper, index, …])
DataFrame.rename
Alter axes labels.
DataFrame.rename_axis(self[, mapper, index, …])
DataFrame.rename_axis
Set the name of the axis for the index or columns.
DataFrame.reset_index(self, level, …)
DataFrame.reset_index
Reset the index, or a level of it.
DataFrame.sample(self[, n, frac, replace, …])
DataFrame.sample
Return a random sample of items from an axis of object.
DataFrame.set_axis(self, labels[, axis, inplace])
DataFrame.set_axis
Assign desired index to given axis.
DataFrame.set_index(self, keys[, drop, …])
DataFrame.set_index
Set the DataFrame index using existing columns.
DataFrame.take(self, indices[, axis])
DataFrame.take
Return the elements in the given positional indices along an axis.
DataFrame.truncate(self[, before, after, axis])
DataFrame.truncate
Truncate a Series or DataFrame before and after some index value.
DataFrame.dropna(self[, axis, how, thresh, …])
DataFrame.dropna
Remove missing values.
DataFrame.fillna(self[, value, method, …])
DataFrame.fillna
Fill NA/NaN values using the specified method.
DataFrame.replace(self[, to_replace, value, …])
DataFrame.replace
Replace values given in to_replace with value.
DataFrame.interpolate(self[, method, axis, …])
DataFrame.interpolate
Interpolate values according to different methods.
DataFrame.droplevel(self, level[, axis])
DataFrame.droplevel
Return DataFrame with requested index / column level(s) removed.
DataFrame.pivot(self[, index, columns, values])
DataFrame.pivot
Return reshaped DataFrame organized by given index / column values.
DataFrame.pivot_table(self[, values, index, …])
DataFrame.pivot_table
Create a spreadsheet-style pivot table as a DataFrame.
DataFrame.reorder_levels(self, order[, axis])
DataFrame.reorder_levels
Rearrange index levels using input order.
DataFrame.sort_values(self, by[, axis, …])
DataFrame.sort_values
Sort by the values along either axis.
DataFrame.sort_index(self[, axis, level])
DataFrame.sort_index
Sort object by labels (along an axis).
DataFrame.nlargest(self, n, columns[, keep])
DataFrame.nlargest
Return the first n rows ordered by columns in descending order.
DataFrame.nsmallest(self, n, columns[, keep])
DataFrame.nsmallest
Return the first n rows ordered by columns in ascending order.
DataFrame.swaplevel(self[, i, j, axis])
DataFrame.swaplevel
Swap levels i and j in a MultiIndex on a particular axis.
DataFrame.stack(self[, level, dropna])
DataFrame.stack
Stack the prescribed level(s) from columns to index.
DataFrame.unstack(self[, level, fill_value])
DataFrame.unstack
Pivot a level of the (necessarily hierarchical) index labels.
DataFrame.swapaxes(self, axis1, axis2[, copy])
DataFrame.swapaxes
Interchange axes and swap values axes appropriately.
DataFrame.melt(self[, id_vars, value_vars, …])
DataFrame.melt
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
DataFrame.explode(self, column, Tuple])
DataFrame.explode
Transform each element of a list-like to a row, replicating index values.
DataFrame.squeeze(self[, axis])
DataFrame.squeeze
Squeeze 1 dimensional axis objects into scalars.
DataFrame.to_xarray(self)
DataFrame.to_xarray
Return an xarray object from the pandas object.
DataFrame.T
Transpose index and columns.
DataFrame.transpose(self, \*args, copy)
DataFrame.transpose
DataFrame.append(self, other[, …])
DataFrame.append
Append rows of other to the end of caller, returning a new object.
DataFrame.assign(self, \*\*kwargs)
DataFrame.assign
Assign new columns to a DataFrame.
DataFrame.join(self, other[, on, how, …])
DataFrame.join
Join columns of another DataFrame.
DataFrame.merge(self, right[, how, on, …])
DataFrame.merge
Merge DataFrame or named Series objects with a database-style join.
DataFrame.update(self, other[, join, …])
DataFrame.update
Modify in place using non-NA values from another DataFrame.
DataFrame.asfreq(self, freq[, method, …])
DataFrame.asfreq
Convert TimeSeries to specified frequency.
DataFrame.asof(self, where[, subset])
DataFrame.asof
Return the last row(s) without any NaNs before where.
DataFrame.shift(self[, periods, freq, axis, …])
DataFrame.shift
Shift index by desired number of periods with an optional time freq.
DataFrame.slice_shift(self, periods[, axis])
DataFrame.slice_shift
Equivalent to shift without copying data.
DataFrame.tshift(self, periods[, freq, axis])
DataFrame.tshift
Shift the time index, using the index’s frequency if available.
DataFrame.first_valid_index(self)
DataFrame.first_valid_index
Return index for first non-NA/null value.
DataFrame.last_valid_index(self)
DataFrame.last_valid_index
Return index for last non-NA/null value.
DataFrame.resample(self, rule[, axis, …])
DataFrame.resample
Resample time-series data.
DataFrame.to_period(self[, freq, axis, copy])
DataFrame.to_period
Convert DataFrame from DatetimeIndex to PeriodIndex.
DataFrame.to_timestamp(self[, freq, how, …])
DataFrame.to_timestamp
Cast to DatetimeIndex of timestamps, at beginning of period.
DataFrame.tz_convert(self, tz[, axis, level])
DataFrame.tz_convert
Convert tz-aware axis to target time zone.
DataFrame.tz_localize(self, tz[, axis, …])
DataFrame.tz_localize
Localize tz-naive index of a Series or DataFrame to target time zone.
DataFrame.attrs is a dictionary for storing global metadata for this DataFrame.
DataFrame.attrs
Warning
DataFrame.attrs is considered experimental and may change without warning.
Dictionary of global attributes on this object.
DataFrame.plot is both a callable method and a namespace attribute for specific plotting methods of the form DataFrame.plot.<kind>.
DataFrame.plot
DataFrame.plot.<kind>
DataFrame.plot([x, y, kind, ax, ….])
DataFrame plotting accessor and method
DataFrame.plot.area(self[, x, y])
DataFrame.plot.area
Draw a stacked area plot.
DataFrame.plot.bar(self[, x, y])
DataFrame.plot.bar
Vertical bar plot.
DataFrame.plot.barh(self[, x, y])
DataFrame.plot.barh
Make a horizontal bar plot.
DataFrame.plot.box(self[, by])
DataFrame.plot.box
Make a box plot of the DataFrame columns.
DataFrame.plot.density(self[, bw_method, ind])
DataFrame.plot.density
Generate Kernel Density Estimate plot using Gaussian kernels.
DataFrame.plot.hexbin(self, x, y[, C, …])
DataFrame.plot.hexbin
Generate a hexagonal binning plot.
DataFrame.plot.hist(self[, by, bins])
DataFrame.plot.hist
Draw one histogram of the DataFrame’s columns.
DataFrame.plot.kde(self[, bw_method, ind])
DataFrame.plot.kde
DataFrame.plot.line(self[, x, y])
DataFrame.plot.line
Plot Series or DataFrame as lines.
DataFrame.plot.pie(self, \*\*kwargs)
DataFrame.plot.pie
Generate a pie plot.
DataFrame.plot.scatter(self, x, y[, s, c])
DataFrame.plot.scatter
Create a scatter plot with varying marker point size and color.
DataFrame.boxplot(self[, column, by, ax, …])
DataFrame.boxplot
Make a box plot from DataFrame columns.
DataFrame.hist(data[, column, by, grid, …])
DataFrame.hist
Make a histogram of the DataFrame’s.
Sparse-dtype specific methods and attributes are provided under the DataFrame.sparse accessor.
DataFrame.sparse
DataFrame.sparse.density
Ratio of non-sparse points to total (dense) data points.
DataFrame.sparse.from_spmatrix(data[, …])
DataFrame.sparse.from_spmatrix
Create a new DataFrame from a scipy sparse matrix.
DataFrame.sparse.to_coo(self)
DataFrame.sparse.to_coo
Return the contents of the frame as a sparse SciPy COO matrix.
DataFrame.sparse.to_dense(self)
DataFrame.sparse.to_dense
Convert a DataFrame with sparse values to dense.
DataFrame.from_dict(data[, orient, dtype, …])
DataFrame.from_dict
Construct DataFrame from dict of array-like or dicts.
DataFrame.from_records(data[, index, …])
DataFrame.from_records
Convert structured or record ndarray to DataFrame.
DataFrame.info(self[, verbose, buf, …])
DataFrame.info
Print a concise summary of a DataFrame.
DataFrame.to_parquet(self, path[, engine, …])
DataFrame.to_parquet
Write a DataFrame to the binary parquet format.
DataFrame.to_pickle(self, path, compression, …)
DataFrame.to_pickle
Pickle (serialize) object to file.
DataFrame.to_csv(self, path_or_buf, …)
DataFrame.to_csv
Write object to a comma-separated values (csv) file.
DataFrame.to_hdf(self, path_or_buf, key, …)
DataFrame.to_hdf
Write the contained data to an HDF5 file using HDFStore.
DataFrame.to_sql(self, name, con[, schema, …])
DataFrame.to_sql
Write records stored in a DataFrame to a SQL database.
DataFrame.to_dict(self[, orient, into])
DataFrame.to_dict
Convert the DataFrame to a dictionary.
DataFrame.to_excel(self, excel_writer[, …])
DataFrame.to_excel
Write object to an Excel sheet.
DataFrame.to_json(self, path_or_buf, …)
DataFrame.to_json
Convert the object to a JSON string.
DataFrame.to_html(self[, buf, columns, …])
DataFrame.to_html
Render a DataFrame as an HTML table.
DataFrame.to_feather(self, path)
DataFrame.to_feather
Write out the binary feather-format for DataFrames.
DataFrame.to_latex(self[, buf, columns, …])
DataFrame.to_latex
Render object to a LaTeX tabular, longtable, or nested table/tabular.
DataFrame.to_stata(self, path[, …])
DataFrame.to_stata
Export DataFrame object to Stata dta format.
DataFrame.to_gbq(self, destination_table[, …])
DataFrame.to_gbq
Write a DataFrame to a Google BigQuery table.
DataFrame.to_records(self[, index, …])
DataFrame.to_records
Convert DataFrame to a NumPy record array.
DataFrame.to_string(self, buf, pathlib.Path, …)
DataFrame.to_string
Render a DataFrame to a console-friendly tabular output.
DataFrame.to_clipboard(self, excel, sep, …)
DataFrame.to_clipboard
Copy object to the system clipboard.
DataFrame.to_markdown(self, buf, …)
DataFrame.to_markdown
Print DataFrame in Markdown-friendly format.
DataFrame.style
Returns a Styler object.