Danfo.js
  • Danfo.js Documentation
  • Getting Started
  • API reference
    • General Functions
      • danfo.tensorflow
      • danfo. convertFunctionTotransformer
      • danfo.streamCsvTransformer
      • danfo.streamJSON
      • danfo.streamCSV
      • danfo.Utils
      • danfo.Str
      • danfo.Dt
      • danfo.dateRange
      • danfo.OneHotEncoder
      • danfo.StandardScaler
      • danfo.MinMaxScaler
      • danfo.LabelEncoder
      • danfo.toDateTime
      • danfo.getDummies
      • danfo.concat
      • danfo.merge
    • Input/Output
      • danfo.readExcel
      • danfo.toExcel
      • danfo.readJSON
      • danfo.toJSON
      • danfo.readCSV
      • danfo.toCSV
    • Series
      • Creating a Series
      • Series.append
      • Series.cumSum
      • Series.cumMax
      • Series.cumProd
      • Series.cumMin
      • Series.str.split
      • Series.str.len
      • Series.str.join
      • Series.str.trim
      • Series.str.substring
      • Series.str.substr
      • Series.str.slice
      • Series.str.search
      • Series.str.repeat
      • Series.str.replace
      • Series.str.lastIndexOf
      • Series.str.indexOf
      • Series.str.includes
      • Series.str.endsWith
      • Series.str.startsWith
      • Series.str.concat
      • Series.str.charAt
      • Series.str.toUpperCase
      • Series.str.toLowerCase
      • Series.str.capitalize
      • Series.dt.seconds
      • Series.dt.minutes
      • Series.dt.dayOfMonth
      • Series.dt.monthName
      • Series.dt.hours
      • Series.dt.dayOfWeek
      • Series.dt.dayOfWeek
      • Series.dt.month
      • Series.dt.year
      • Series.argMax
      • Series.argMin
      • Series.argSort
      • Series.replace
      • Series.isNa
      • Series.fillNa
      • Series.dropNa
      • Series.dropDuplicates
      • Series.valueCounts
      • Series.nUnique
      • Series.unique
      • Series.abs
      • Series.ne
      • Series.eq
      • Series.ge
      • Series.le
      • Series.gt
      • Series.lt
      • Series.iloc
      • Series.loc
      • Series.at
      • Series.iat
      • Series.ndim
      • Series.shape
      • Series.dtype
      • Series.values
      • Series.tensor
      • Series.index
      • Series.apply
      • Series.map
      • Series.setIndex
      • Series.resetIndex
      • Series.describe
      • Series.copy
      • Series.sortValues
      • Series.var
      • Series.std
      • Series.round
      • Series.minimum
      • Series.maximum
      • Series.count
      • Series.sum
      • Series.max
      • Series.min
      • Series.mode
      • Series.median
      • Series.mean
      • Series.mod
      • Series.pow
      • Series.div
      • Series.mul
      • Series.sub
      • Series.add
      • Series.sample
      • Series.tail
      • Series.head
      • Series.and
      • Series.or
    • Dataframe
      • Creating a DataFrame
      • DataFrame.sortIndex
      • DataFrame.append
      • DataFrame.nUnique
      • DataFrame.tensor
      • DataFrame.print
      • DataFrame.toCSV
      • DataFrame.toJSON
      • DataFrame.toExcel
      • DataFrame.sortValues
      • DataFrame.setIndex
      • DataFrame.resetIndex
      • DataFrame.rename
      • DataFrame.drop
      • DataFrame.asType
      • DataFrame.shape
      • DataFrame.axis
      • DataFrame.ndim
      • DataFrame.values
      • DataFrame.selectDtypes
      • DataFrame.ctypes
      • DataFrame.index
      • DataFrame.loc
      • DataFrame.iloc
      • DataFrame.at
      • DataFrame.iat
      • DataFrame.head
      • DataFrame.tail
      • DataFrame.sample
      • DataFrame.add
      • DataFrame.sub
      • DataFrame.mul
      • DataFrame.div
      • DataFrame.pow
      • DataFrame.mod
      • DataFrame.mean
      • DataFrame.median
      • DataFrame.min
      • DataFrame.max
      • DataFrame.std
      • DataFrame.var
      • DataFrame.count
      • DataFrame.round
      • DataFrame.cumSum
      • DataFrame.cumMin
      • DataFrame.cumMax
      • DataFrame.cumProd
      • DataFrame.copy
      • DataFrame.describe
      • DataFrame.sum
      • DataFrame.abs
      • DataFrame.query
      • DataFrame.addColumn
      • DataFrame.groupby
      • DataFrame.column
      • DataFrame.fillNa
      • DataFrame.isNa
      • DataFrame.dropNa
      • DataFrame.apply
      • DataFrame.applyMap
      • DataFrame.It
      • DataFrame.gt
      • DataFrame.le
      • DataFrame.ge
      • DataFrame.ne
      • DataFrame.eq
      • DataFrame.replace
    • Configuration Options
    • Plotting
      • Timeseries Plots
      • Violin Plots
      • Box Plots
      • Tables
      • Pie Charts
      • Histograms
      • Scatter Plots
      • Bar Charts
      • Line Charts
      • Customizing your plots
    • Groupby
      • Groupby.getGroups
      • Groupby.col
      • Groupby.max
      • Groupby.min
      • Groupby.sum
      • Groupby.mean
      • Groupby.std
      • Groupby.var
      • Groupby.count
      • Groupby.cumSum
      • Groupby.cumMax
      • Groupby.cumMin
      • Groupby.cumProd
      • Groupby.agg
  • User Guides
    • Migrating to the stable version of Danfo.js
    • Using Danfojs in React
    • Titanic Survival Prediction using Danfo.js and Tensorflow.js
  • Building Data Driven Applications with Danfo.js - Book
  • Contributing Guide
  • Release Notes
Powered by GitBook
On this page
  • Attributes
  • Conversion
  • Indexing, iteration
  • Binary operator functions
  • Function application
  • Computations / descriptive stats
  • Reindexing / selection / label manipulation
  • Missing data handling
  • Logical Comparison
  • Reshaping, sorting
  • Accessors
  • Plotting
  • Serialization / IO / conversion

Was this helpful?

  1. API reference

Series

One-dimensional ndarray with axis labels (including time series).

Previousdanfo.toCSVNextCreating a Series

Last updated 3 years ago

Was this helpful?

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

Attributes

The index (axis labels) of the Series.

The Tensorflow tensor of the data backing this Series or Index.

Return Series as ndarray or ndarray-like depending on the dtype.

Return the dtype object of the underlying data.

Return a tuple of the shape of the underlying data.

Number of dimensions of the underlying data, by definition 1.

Return the number of elements in the underlying data.

Conversion

Cast a Series object to a specified dtype

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

Indexing, iteration

[`Series.loc`](series.loc.md)

Access a group of rows and columns by label(s) or a boolean array.

Purely integer-location based indexing for selection by position.

Binary operator functions

Return Addition of series and other, element-wise (binary operator add).

Return Subtraction of series and other, element-wise (binary operator sub).

Return Multiplication of series and other, element-wise (binary operator mul).

Return Floating division of series and other, element-wise (binary operator truediv).

Return Modulo of series and other, element-wise (binary operator mod).

Return Exponential power of series and other, element-wise (binary operator pow).

Round each value in a Series to the given number of decimals.

Return Less than of series and other, element-wise (binary operator lt).

Return Greater than of series and other, element-wise (binary operator gt).

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

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

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

Return Equal to of series and other, element-wise (binary operator eq).

Function application

Invoke function on values of Series.

Map values of Series according to input correspondence.

Computations / descriptive stats

Return a Series with absolute numeric value of each element.

Compute correlation with other Series, excluding missing values.

Return number of non-NaN observations in the Series.

Return cumulative maximum over a DataFrame or Series axis.

Return cumulative minimum over a DataFrame or Series axis.

Return cumulative product over a DataFrame or Series axis.

Return cumulative sum over a DataFrame or Series axis.

Generate descriptive statistics.

Return the maximum of the values for the requested axis.

Return the mean of the values for the requested axis.

Return the median of the values for the requested axis.

Return the minimum of the values for the requested axis.

Return the mode(s) of the dataset.

Return sample standard deviation over requested axis.

Return the sum of the values for the requested axis.

Return unbiased variance over requested axis.

Return unique values of Series object.

Return number of unique elements in the object.

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation

Return Series with duplicate values removed.

Return the first n rows.

Generate a new DataFrame or Series with the index reset.

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

Return the last n rows.

Missing data handling

Return a new Series with missing values removed.

Fill NaN values using the specified method.

Detect missing values.

Replace values given in to_replace with value.

Logical Comparison

Returns the logical OR between Series and other. Supports element-wise operations and broadcasting.

Returns the logical AND between Series and other. Supports element-wise operations and broadcasting.

Reshaping, sorting

Return the integer indices that would sort the Series values.

Return int position of the smallest value in the Series.

Return int position of the largest value in the Series.

Sort by the values.

Accessors

Data Type
Accessor

dt

str

Datetimelike properties

Series.dt can be used to access the values of the series as datetime and return several properties. These can be accessed like Series.dt.<property>.

Datetime methods

The year of the datetime.

Returns a numeric representation of the month. January=0 - December=11.

Returns the day of the week, in local time

The hours of the datetime.

The minutes of the datetime.

The seconds of the datetime.

Returns the name of the day, of the week, in local time

Returns the day of the month, in local time

String handling

Series.str can be used to access the values of the series as strings and apply several methods to it. These can be accessed like Series.str.<function/property>.

Capitalize the first character of each string

Converts all characters to uppercase.

Converts all characters to lowercase.

Returns the character at the specified index (position).

Joins two or more strings/arrays.

Checks whether a string begins with specified characters.

Checks whether a string ends with specified characters

Checks whether a string contains the specified string/characters.

Returns the position of the first found occurrence of a specified value in a string.

Returns the position of the last found occurrence of a specified value in a string.

Returns a new string with a specified number of copies of an existing string.

Searches a string for a specified value, or regular expression, and returns the position of the match.

Extracts a part of a string and returns a new string.

Splits a string into an array of substrings.

Extracts the characters from a string, beginning at a specified start position, and through the specified number of character.

Extracts the characters from a string, between two specified indices.

Counts the number of characters in each string.

Removes whitespace from both ends of a string.

Joins strings to specified value.

Replace each occurrence of pattern/regex in the Series/Index.

Plotting

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

Vertical bar plot.

Make a box plot of the DataFrame columns.

Make a violin plot of the DataFrame columns.

Draw one histogram of the DataFrame’s columns.

Generate Kernel Density Estimate plot using Gaussian kernels.

Plot Series or DataFrame as lines.

Generate a pie plot.

Time series plots

Display Series as Interactive table in a Div

Serialization / IO / conversion

Convert DataFrame or Series to CSV.

Convert DataFrame or Series to a JSON.

Series.toExcel

Convert DataFrame or Series to an excel file

Danfo provides dtype-specific methods under various accessors. These are separate namespaces within that only apply to specific data types.

source
Series
Series.index
Series.tensor
Series.values
Series.dtype
Series.shape
Series.ndim
Series.size
Series.asType
Series.copy
Series.iloc
Series.add
Series.sub
Series.mul
Series.div
Series.mod
Series.pow
Series.round
Series.lt
Series.gt
Series.le
Series.ge
Series.ne
Series.eq
Series.apply
Series.map
Series.abs
Series.corr
Series.count
Series.cumMax
Series.cumMin
Series.cumProd
Series.cumSum
Series.describe
Series.max
Series.mean
Series.median
Series.min
Series.mode
Series.std
Series.sum
Series.var
Series.unique
Series.nUnique
Series.valueCounts
Series.dropDuplicates
Series.head
Series.resetIndex
Series.sample
Series.tail
Series.droNa
Series.fillNa
Series.isNa
Series.replace
Series.or
Series.and
Series.argSort
Series.argMin
Series.argMax
Series.sortValues
Datetime
String
Series.dt.year
Series.dt.month
Series.dt.monthName
Series.dt.dayOfWeek
Series.dt.hour
Series.dt.minute
Series.dt.second
Series.dt.dayOfWeekName
Series.dt.dayOfMonth
Series.str.capitalize
Series.str.toUpperCase
Series.str.toLowerCase
Series.str.charAt
Series.str.concat
Series.str.startsWith
Series.str.endsWith
Series.str.includes
Series.str.indexOf
Series.str.lastIndexOf
Series.str.repeat
Series.str.search
Series.str.slice
Series.str.split
Series.str.substr
Series.str.substring
Series.str.len
Series.str.trim
Series.str.join
Series.str.replace
Series.plot.bar
Series.plot.box
Series.plot.violin
Series.plot.hist
Series.plot.scatter
Series.plot.line
Series.plot.pie
Timeseries Plots
Table
Series.toCSV
Series.toJSON