Dataframe

Two-dimensional, size-mutable, potentially heterogeneous tabular data.

DataFrame(data, {columns: [ Array ], dtypes: [ Array ], index: [Array]}) [source]

Attributes

DataFrame.index

The index (row labels) of the DataFrame.

DataFrame.columns

The column labels of the DataFrame.

DataFrame.ctypes

Return the data types in the DataFrame.

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 Object 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.

Conversion

DataFrame.astype

Cast a pandas object to a specified dtype dtype.

DataFrame.copy

Make a copy of this object’s indices and data.

Indexing, iteration

DataFrame.head

Return the first n rows

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.tail

Return the last n rows.

DataFrame.query

Query the columns of a DataFrame with a boolean expression.

Binary operator functions

DataFrame.add

Get Addition of dataframe and other, element-wise (binary operator add).

DataFrame.sub

Get Subtraction of dataframe and other, element-wise (binary operator sub).

DataFrame.mul

Get Multiplication of dataframe and other, element-wise (binary operator mul).

DataFrame.div

Get Floating division of dataframe and other, element-wise (binary operator truediv).

DataFrame.mod

Get Modulo of dataframe and other, element-wise (binary operator mod).

DataFrame.pow

Get Exponential power of dataframe and other, element-wise (binary operator pow).

DataFrame.lt

Get Less than of dataframe and other, element-wise (binary operator lt).

DataFrame.gt

Get Greater than of dataframe and other, element-wise (binary operator gt).

DataFrame.le

Get Less than or equal to of dataframe and other, element-wise (binary operator le).

DataFrame.ge

Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).

DataFrame.ne

Get Not equal to of dataframe and other, element-wise (binary operator ne).

DataFrame.eq

Get Equal to of dataframe and other, element-wise (binary operator eq).

Function application & GroupBy

DataFrame.apply

Apply a function along an axis of the DataFrame.

DataFrame.groupby

Group DataFrame using a mapper or by a Series of columns.

DataFrame.map

Map a function on Object along an axis to DataFrame

Computations / descriptive stats

DataFrame.abs

Return a Series/DataFrame with absolute numeric value of each element.

DataFrame.corr

Compute pairwise correlation of columns, excluding NA/null values.

DataFrame.count

Count non-NAN cells for each column or row.

DataFrame.cummax

Return cumulative maximum over a DataFrame or Series axis.

DataFrame.cummin

Return cumulative minimum over a DataFrame or Series axis.

DataFrame.cumprod

Return cumulative product over a DataFrame or Series axis.

DataFrame.cumsum

Return cumulative sum over a DataFrame or Series axis.

DataFrame.describe

Generate descriptive statistics.

DataFrame.max

Return the maximum of the values for the requested axis.

DataFrame.mean

Return the mean of the values for the requested axis.

DataFrame.median

Return the median of the values for the requested axis.

DataFrame.min

Return the minimum of the values for the requested axis.

DataFrame.mode

Get the mode(s) of each element along the selected axis.

DataFrame.round

Round a DataFrame to a variable number of decimal places.

DataFrame.sum

Return the sum of the values for the requested axis.

DataFrame.std

Return sample standard deviation over requested axis.

DataFrame.var

Return unbiased variance over requested axis.

DataFrame.nunique

Count distinct observations over requested axis.

Reindexing / selection / label manipulation

DataFrame.drop

Drop specified labels from rows or columns.

DataFrame.head

Return the first n rows.

DataFrame.rename

Alter axes labels.

DataFrame.reset_index

Reset the index of a DataFrame

DataFrame.sample

Return a random sample of items from an axis of object.

DataFrame.set_index

Set the DataFrame index using existing columns.

DataFrame.tail

Return the last n rows.

Missing data handling

DataFrame.dropna

Remove missing values.

DataFrame.fillna

Fill NaN values with specified values

DataFrame.isna

Detect missing values.

DataFrame.replace

Replace values given in replace with value.

Sorting & transposing

DataFrame.sort_values

Sort by the values along either axis.

DataFrame.T

Return transpose of DataFrame

Combining / comparing / joining / merging

DataFrame.addColumn

Add new columns to a DataFrame.

DataFrame.concat

Concatenate DataFrames together.

DataFrame.merge

Merge DataFrame or named Series objects with a database-style join.

Plotting

Series.plot is both a callable method and a namespace attribute for specific plotting methods of the form Series.plot.<kind>.

DataFrame.plot.bar

Vertical bar plot.

DataFrame.plot.box

Make a box plot of the DataFrame columns.

DataFrame.plot.violin

Make a violin plot of the DataFrame columns.

DataFrame.plot.hist

Draw one histogram of the DataFrame’s columns.

DataFrame.plot.scatter

Generate Kernel Density Estimate plot using Gaussian kernels.

DataFrame.plot.line

Plot Series or DataFrame as lines.

DataFrame.plot.pie

Generate a pie plot.

Timeseries Plots

Time series plots

Table

Display Series as Interactive table in Div

Serialization / IO / conversion

DataFrame.to_csv

Write object to a comma-separated values (csv) file.

DataFrame.to_json

Convert the object to a JSON string.