# Dataframe ### Attributes | [`DataFrame.index`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.index) | The index (row labels) of the DataFrame. | | ---------------------------------------------------------------------------------------------- | ---------------------------------------- | | [`DataFrame.columns`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.column) | The column labels of the DataFrame. | | [`DataFrame.ctypes`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.dtypes) | | | -------------------------------------------------------------------------------------------------------------------------------- | - | | [`DataFrame.values`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.values) | | | [`DataFrame.axis`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.axes) | | | [`DataFrame.ndim`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.ndim) | | | [`DataFrame.size`](https://github.com/javascriptdata/danfojs-doc/blob/master/api-reference/dataframe/broken-reference/README.md) | | | [`DataFrame.shape`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.shape) | | ### Conversion | [`DataFrame.asType`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.astype) | Cast a pandas object to a specified dtype `dtype`. | | ----------------------------------------------------------------------------------------- | -------------------------------------------------- | | [`DataFrame.copy`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.copy) | Make a copy of this object’s indices and data. | ### Indexing, iteration | [`DataFrame.head`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.head) | Return the first n rows | | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | [`DataFrame.loc`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.loc) | Access a group of rows and columns by label(s) or a boolean array. | | [`DataFrame.iloc`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.iloc) | Purely integer-location based indexing for selection by position. | | [`DataFrame.tail`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.tail) | Return the last n rows. | | [`DataFrame.query`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.query) | Query the columns of a DataFrame with a boolean expression. | ### Binary operator functions | [`DataFrame.add`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.add) | Get Addition of dataframe and other, element-wise (binary operator add). | | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | | [`DataFrame.sub`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.sub) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | | [`DataFrame.mul`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.mul) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | | [`DataFrame.div`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.div) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | | [`DataFrame.mod`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.mod) | Get Modulo of dataframe and other, element-wise (binary operator mod). | | [`DataFrame.pow`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.pow) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | | [`DataFrame.lt`](https://github.com/javascriptdata/danfojs-doc/blob/master/api-reference/dataframe/broken-reference/README.md) | Get Less than of dataframe and other, element-wise (binary operator lt). | | [`DataFrame.gt`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.gt) | Get Greater than of dataframe and other, element-wise (binary operator gt). | | [`DataFrame.le`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.le) | Get Less than or equal to of dataframe and other, element-wise (binary operator le). | | [`DataFrame.ge`](https://github.com/javascriptdata/danfojs-doc/blob/master/api-reference/dataframe/broken-reference/README.md) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | | [`DataFrame.ne`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.ne) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | | [`DataFrame.eq`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.eq) | Get Equal to of dataframe and other, element-wise (binary operator eq). | ### Function application & GroupBy | [`DataFrame.apply`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.apply) | Apply a function along an axis of the DataFrame. | | ------------------------------------------------------------------------------------------- | --------------------------------------------------------- | | [`DataFrame.groupby`](https://danfo.jsdata.org/api-reference/groupby) | Group DataFrame using a mapper or by a Series of columns. | | [`DataFrame.map`](https://danfo.jsdata.org/api-reference/series/series.map) | Map a function on Object along an axis to DataFrame | ### Computations / descriptive stats | [`DataFrame.abs`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.abs) | Return a Series/DataFrame with absolute numeric value of each element. | | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | [`DataFrame.corr`](https://github.com/javascriptdata/danfojs-doc/blob/master/api-reference/dataframe/broken-reference/README.md) | Compute pairwise correlation of columns, excluding NA/null values. | | [`DataFrame.count`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.count) | Count non-NAN cells for each column or row. | | [`DataFrame.cumMax`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.cummax) | Return cumulative maximum over a DataFrame or Series axis. | | [`DataFrame.cumMin`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.cummin) | Return cumulative minimum over a DataFrame or Series axis. | | [`DataFrame.cumProd`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.cumprod) | Return cumulative product over a DataFrame or Series axis. | | [`DataFrame.cumSum`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.cumsum) | Return cumulative sum over a DataFrame or Series axis. | | [`DataFrame.describe`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.describe) | Generate descriptive statistics. | | [`DataFrame.max`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.max) | Return the maximum of the values for the requested axis. | | [`DataFrame.mean`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.mean) | Return the mean of the values for the requested axis. | | [`DataFrame.median`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.median) | Return the median of the values for the requested axis. | | [`DataFrame.min`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.min) | Return the minimum of the values for the requested axis. | | [`DataFrame.mode`](https://danfo.jsdata.org/api-reference/series/series.mode) | Get the mode(s) of each element along the selected axis. | | [`DataFrame.round`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.round) | Round a DataFrame to a variable number of decimal places. | | [`DataFrame.sum`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.sum) | Return the sum of the values for the requested axis. | | [`DataFrame.std`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.std) | Return sample standard deviation over requested axis. | | [`DataFrame.var`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.var) | Return unbiased variance over requested axis. | | [`DataFrame.nUnique`](https://github.com/javascriptdata/danfojs-doc/blob/master/api-reference/dataframe/broken-reference/README.md) | Count distinct observations over requested axis. | ### Reindexing / selection / label manipulation | | | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | | [`DataFrame.drop`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.drop) | Drop specified labels from rows or columns. | | [`DataFrame.head`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.head) | Return the first n rows. | | [`DataFrame.rename`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.rename) | Alter axes labels. | | [`DataFrame.resetIndex`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.reset_index) | Reset the index of a DataFrame | | [`DataFrame.sample`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.sample) | Return a random sample of items from an axis of object. | | [`DataFrame.setIndex`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.set_index) | Set the DataFrame index using existing columns. | | [`DataFrame.tail`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.tail) | Return the last n rows. | ### Missing data handling | | | | ----------------------------------------------------------------------------------------------- | ------------------------------------------- | | [`DataFrame.dropNa`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.dropna) | Remove missing values. | | [`DataFrame.fillNa`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.fillna) | Fill NaN values with specified values | | [`DataFrame.isNa`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.isna) | Detect missing values. | | [`DataFrame.replace`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.replace) | Replace values given in replace with value. | ### Sorting & transposing | | | | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | | [`DataFrame.sortVlues`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.sort_values) | Sort by the values along either axis. | | [`DataFrame.T`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.T.html#pandas.DataFrame.T) | Return transpose of DataFrame | ### Combining / comparing / joining / merging | | | | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | | [`DataFrame.addColumn`](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.addcolumn) | Add new columns to a DataFrame. | | [`DataFrame.concat`](https://danfo.jsdata.org/api-reference/general-functions/danfo.concat) | Concatenate DataFrames together. | | [`DataFrame.merge`](https://danfo.jsdata.org/api-reference/general-functions/danfo.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.`. | | | | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | [DataFrame.plot.bar](https://danfo.jsdata.org/api-reference/plotting/bar-charts) | Vertical bar plot. | | [`DataFrame.plot.box`](https://danfo.jsdata.org/api-reference/plotting/box-plots) | Make a box plot of the DataFrame columns. | | [`DataFrame.plot.violin`](https://danfo.jsdata.org/api-reference/plotting/box-plots) | Make a violin plot of the DataFrame columns. | | [`DataFrame.plot.hist`](https://danfo.jsdata.org/api-reference/plotting/histograms) | Draw one histogram of the DataFrame’s columns. | | [`DataFrame.plot.scatter`](https://danfo.jsdata.org/api-reference/plotting/scatter-plots) | Generate Kernel Density Estimate plot using Gaussian kernels. | | [`DataFrame.plot.line`](https://danfo.jsdata.org/api-reference/plotting/line-charts) | Plot Series or DataFrame as lines. | | [`DataFrame.plot.pie`](https://danfo.jsdata.org/api-reference/plotting/pie-charts) | Generate a pie plot. | | [`Timeseries Plots`](https://danfo.jsdata.org/api-reference/plotting/timeseries-plots) | Time series plots | | [`Table`](https://danfo.jsdata.org/api-reference/plotting/tables) | Display Series as Interactive table in Div | ### Serialization / IO / conversion | | | | ---------------------------------------------------------------------------------------- | -------------------------------- | | [`DataFrame.toCSV`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.to_csv) | Convert DataFrame to a CSV file. | | [`DataFrame.toJSON`](https://danfo.jsdata.org/api-reference/dataframe/dataframe.to_json) | Convert the object to a JSON. | | ``[`DataFrame.toExcel`](../input-output/danfo.to\_excel.md)`` | Convert DataFrame to Excel file |