RAPIDS
    Preparing search index...

    Class DataFrame<T>

    A GPU Dataframe object.

    Type Parameters

    Index

    Constructors

    Accessors

    • get names(): readonly (string & keyof T)[]

      The names of columns in this DataFrame

      Returns readonly (string & keyof T)[]

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([1, 2]),
      b: Series.new([1, 2]),
      c: Series.new([1, 2])
      })

      df.names // ['a', 'b', 'c']
    • get numColumns(): number

      The number of columns in this DataFrame

      Returns number

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([1, 2]),
      b: Series.new([1, 2]),
      c: Series.new([1, 2])
      })

      df.numColumns // 3
    • get numRows(): number

      The number of rows in each column of this DataFrame

      Returns number

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([1, 2]),
      b: Series.new([1, 2]),
      c: Series.new([1, 2])
      })

      df.numRows // 2
    • get types(): T

      A map of this DataFrame's Series names to their DataTypes

      Returns T

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([1, 2]),
      b: Series.new(["foo", "bar"]),
      c: Series.new([[1, 2], [3]]),
      })

      df.types
      // {
      // a: [Object Float64],
      // b: [Object Utf8String],
      // c: [Object List]
      // }

    Methods

    • Compute the absolute value for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1, 2, -3, 4, 5])
      });
      df.abs();
      // return {
      // a: [1, 2, 3, 4, 5],
      // }
    • Compute the trigonometric cosine inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.acos();
      // return {
      // a: [0, 1, 0],
      // }
    • Compute the hyperbolic cosine inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.acosh();
      // return {
      // a: [0, 0, 1],
      // }
    • Compute the trigonometric sine inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.asin();
      // return {
      // a: [0, 0, 0],
      // }
    • Compute the hyperbolic sine inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.asinh();
      // return {
      // a: [-1, 0, 1],
      // }
    • Return a new DataFrame with new columns added.

      Type Parameters

      Parameters

      Returns DataFrame<
          {
              [P in string
              | number
              | symbol]: P extends keyof R ? R[P] : P extends keyof T ? T[P] : never
          },
      >

      import {DataFrame, Series} from '@rapidsai/cudf';

      const df = new DataFrame({a: [1, 2, 3]});

      df.assign({b: Series.new(["foo", "bar", "bar"])})
      // returns df {a: [1, 2, 3], b: ["foo", "bar", "bar"]}
      import {DataFrame} from '@rapidsai/cudf';

      const df = new DataFrame({a: [1, 2, 3]});
      const df1 = new DataFrame({b: ["foo", "bar", "bar"]});

      df.assign(df1) // returns df {a: [1, 2, 3], b: ["foo", "bar", "bar"]}
    • Compute the trigonometric tangent inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.atan();
      // return {
      // a: [-1, 0, 1],
      // }
    • Compute the hyperbolic tangent inverse for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.atanh();
      // return {
      // a: [0, 0, 0],
      // }
    • Casts each selected Series in this DataFrame to a new dtype (similar to static_cast in C++).

      Type Parameters

      • R extends { [P in string | number | symbol]?: DataType }

      Parameters

      • dataTypes: R

        The map from column names to new dtypes.

      • OptionalmemoryResource: MemoryResource

        The optional MemoryResource used to allocate the result Series's device memory.

      Returns DataFrame<{ [P in string | number | symbol]: (Omit<T, keyof R> & R)[P] }>

      DataFrame of Series cast to the new dtype

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}),
      b: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 4]})
      });

      df.cast({a: new Float32}); // returns df with a as Float32Series and b as Int32Series
    • Casts all the Series in this DataFrame to a new dtype (similar to static_cast in C++).

      Type Parameters

      Parameters

      • dataType: R

        The new dtype.

      • OptionalmemoryResource: MemoryResource

        The optional MemoryResource used to allocate the result Series's device memory.

      Returns DataFrame<{ [P in string | number | symbol]: R }>

      DataFrame of Series cast to the new dtype const df = new DataFrame({ a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}), b: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 4]}) })

      df.castAll(new Float32); // returns df with a and b as Float32Series

      
      
    • Compute the cube-root (x^(1.0/3)) for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5])
      });
      df.cbrt();
      // return {
      // a: [-1.0626585691826111, 1.3572088082974534],
      // }
    • Compute the smallest integer value not less than arg for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5, -3, 4.6, 5])
      });
      df.ceil();
      // return {
      // a: [-1, 3, -3, 5, 5],
      // }
    • Concat DataFrame(s) to the end of the caller, returning a new DataFrame.

      Type Parameters

      Parameters

      • ...others: U

        The DataFrame(s) to concat to the end of the caller.

      Returns ConcatTypeMap<DataFrame<T>, U>[keyof ConcatTypeMap<DataFrame<T>, U>] extends never
          ? never
          : DataFrame<
              { [P in string
              | number
              | symbol]: ConcatTypeMap<DataFrame<T>, U>[P] },
          >

      import {DataFrame, Series} from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([1, 2, 3, 4]),
      b: Series.new([1, 2, 3, 4]),
      });

      const df2 = new DataFrame({
      a: Series.new([5, 6, 7, 8]),
      });

      df.concat(df2);
      // return {
      // a: [1, 2, 3, 4, 5, 6, 7, 8],
      // b: [1, 2, 3, 4, null, null, null, null],
      // }
    • Compute the trigonometric cosine for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.cos();
      // return {
      // a: [0, 1, 0],
      // }
    • Compute the hyperbolic cosine for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.cosh();
      // return {
      // a: [10, 1, 10],
      // }
    • Return a new DataFrame with specified columns removed.

      Type Parameters

      • R extends string | number | symbol

      Parameters

      • names: readonly R[]

        Names of the columns to drop.

      Returns DataFrame<{ [P in string | number | symbol]: T[P] }>

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}),
      b: Series.new({type: new Float32, data: [0, 1, 2, 3, 4, 4]})
      });

      df.drop(['a']) // returns df {b: [0, 1, 2, 3, 4, 4]}
    • Drops duplicate rows from a DataFrame

      Parameters

      • keep: "none" | "any" | "first" | "last" = 'any'

        Determines whether to keep the first, last, or none of the duplicate items.

      • nullsEqual: boolean = true

        Determines whether nulls are handled as equal values.

      • nullsFirst: boolean = true

        Determines whether null values are inserted before or after non-null values.

      • subset: readonly (string & keyof T)[] = ...

        List of columns to consider when dropping rows (all columns are considered by default).

      • OptionalmemoryResource: MemoryResource

        Memory resource used to allocate the result Column's device memory.

      Returns DataFrame<T>

      a DataFrame without duplicate rows

      
      
    • Drops rows (or columns) containing NaN, provided the columns are of type float

      Type Parameters

      Parameters

      • axis: number = 0

        Whether to drop rows (axis=0, default) or columns (axis=1) containing NaN

      • thresh: number = 1

        drops every row (or column) containing less than thresh non-NaN values.

        thresh=1 (default) drops rows (or columns) containing all NaN values (non-NaN < thresh(1)).

        if axis = 0, thresh=df.numColumns: drops only rows containing at-least one NaN value (non-NaN values in a row < thresh(df.numColumns)).

        if axis = 1, thresh=df.numRows: drops only columns containing at-least one NaN values (non-NaN values in a column < thresh(df.numRows)).

      • Optionalsubset: (string & keyof T)[] | Series<R>

        List of float columns to consider when dropping rows (all float columns are considered by default). Alternatively, when dropping columns, subset is a Series with indices to select rows (all rows are considered by default).

      Returns DataFrame<T>

      DataFrame with dropped rows (or columns) containing NaN

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, NaN, 2, NaN, 4, 4]),
      b: Series.new([0, NaN, 2, 3, NaN, 4]),
      c: Series.new([NaN, NaN, NaN, NaN, NaN, NaN])
      });

      // delete rows with all NaNs (default thresh=1)
      df.dropNaNs(0);
      // return {
      // a: [0, 2, NaN, 4, 4], b: [0, 2, 3, NaN, 4],
      // c: [NaN, NaN, NaN, NaN,NaN]
      // }

      // delete rows with atleast one NaN
      df.dropNaNs(0, df.numColumns);
      // returns empty df, since each row contains atleast one NaN

      // delete columns with all NaNs (default thresh=1)
      df.dropNaNs(1);
      // returns {a: [0, NaN, 2, NaN, 4, 4], b: [0, NaN, 2, 3, NaN, 4]}

      // delete columns with atleast one NaN
      df.dropNaNs(1, df.numRows);
      // returns empty df, since each column contains atleast one NaN
    • Drops rows (or columns) containing nulls (*Note: only null values are dropped and not NaNs)

      Type Parameters

      Parameters

      • axis: number = 0

        Whether to drop rows (axis=0, default) or columns (axis=1) containing nulls

      • thresh: number = 1

        drops every row (or column) containing less than thresh non-null values.

        thresh=1 (default) drops rows (or columns) containing all null values (non-null < thresh(1)).

        if axis = 0, thresh=df.numColumns: drops only rows containing at-least one null value (non-null values in a row < thresh(df.numColumns)).

        if axis = 1, thresh=df.numRows: drops only columns containing at-least one null values (non-null values in a column < thresh(df.numRows)).

      • Optionalsubset: Series<R> | (string & keyof T)[]

        List of columns to consider when dropping rows (all columns are considered by default). Alternatively, when dropping columns, subset is a Series with indices to select rows (all rows are considered by default).

      Returns DataFrame<T>

      DataFrame with dropped rows (or columns) containing nulls

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, null, 2, null, 4, 4]),
      b: Series.new([0, null, 2, 3, null, 4]),
      c: Series.new([null, null, null, null, null, null])
      });

      // delete rows with all nulls (default thresh=1)
      df.dropNulls(0);
      // return {
      // a: [0, 2, null, 4, 4], b: [0, 2, 3, null, 4],
      // c: [null, null, null, null, null]
      // }

      // delete rows with atleast one null
      df.dropNulls(0, df.numColumns);
      // returns empty df, since each row contains atleast one null

      // delete columns with all nulls (default thresh=1)
      df.dropNulls(1);
      // returns {a: [0, null, 2, null, 4, 4], b: [0, null, 2, 3, null, 4]}

      // delete columns with atleast one null
      df.dropNulls(1, df.numRows);
      // returns empty df, since each column contains atleast one null
    • Compute the exponential (base e, euler number) for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5])
      });
      df.exp();
      // return {
      // a: [0.30119421191220214, 12.182493960703473],
      // }
    • Return sub-selection from a DataFrame from the specified boolean mask.

      Parameters

      • mask: Bool8Series
      • OptionalmemoryResource: MemoryResource

      Returns DataFrame<T>

      import {DataFrame, Series, Bool8}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, 1, 2, 3, 4, 4]),
      b: Series.new([0, NaN, 2, 3, 4, 4])
      })
      const mask = Series.new({type: new Bool8, data: [0, 0, 1, 0, 1, 1]})

      df.filter(mask); // {a: [2, 4, 4], b: [2, 4, 4]}
    • Type Parameters

      • R extends string

      Parameters

      • names: readonly R[] = ...

        Names of List Columns to flatten. Defaults to all list Columns.

      • OptionalincludeNulls: boolean = true

        Whether to retain null entries and map empty lists to null.

      • OptionalmemoryResource: MemoryResource

        An optional MemoryResource used to allocate the result's device memory.

      Returns DataFrame<U>

    • Type Parameters

      • R extends string

      Parameters

      • names: readonly R[] = ...

        Names of List Columns to flatten. Defaults to all list Columns.

      • OptionalincludeNulls: boolean = true

        Whether to retain null entries and map empty lists to null.

      • OptionalmemoryResource: MemoryResource

        An optional MemoryResource used to allocate the result's device memory.

      Returns DataFrame<U>

    • Compute the largest integer value not greater than arg for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5, -3, 4.6, 5])
      });
      df.floor();
      // return {
      // a: [-2, 2, -3, 4, 5],
      // }
    • Type Parameters

      Parameters

      • selection: Series<R>

        A Series of 8/16/32-bit signed or unsigned integer indices to gather.

      • nullify_out_of_bounds: boolean = false

        If true, coerce rows that corresponds to out-of-bounds indices in the selection to null. If false, skips all bounds checking for selection values. Pass false if you are certain that the selection contains only valid indices for better performance. If false and there are out-of-bounds indices in the selection, the behavior is undefined. Defaults to false.

      • OptionalmemoryResource: MemoryResource

        An optional MemoryResource used to allocate the result's device memory.

      Returns DataFrame<T>

      Gathers the rows of the source columns according to selection, such that row "i" in the resulting Table's columns will contain row selection[i] from the source columns. The number of rows in the result table will be equal to the number of elements in selection. A negative value i in the selection is interpreted as i+n, where n is the number of rows in the source table.

      For dictionary columns, the keys column component is copied and not trimmed if the gather results in abandoned key elements.

      import {DataFrame, Series, Int32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 5]}),
      b: Series.new([0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
      });

      const selection = Series.new({type: new Int32, data: [2,4,5]});

      df.gather(selection); // {a: [2, 4, 5], b: [2.0, 4.0, 5.0]}
    • Return a series by name.

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • name: P

        Name of the Series to return.

      Returns Series<T[P]>

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}),
      b: Series.new({type: new Float32, data: [0, 1, 2, 3, 4, 4]})
      });

      df.get('a') // Int32Series
      df.get('b') // Float32Series
    • Return a group-by on a single column.

      Type Parameters

      • R extends string | number | symbol

      Parameters

      Returns GroupBySingle<T, R>

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, 1, 1, 2, 2, 2]),
      b: Series.new([0, 1, 2, 3, 4, 4]),
      c: Series.new([1, 2, 3, 4, 5, 6])
      })

      df.groupby({by: 'a'}).max() // { a: [2, 1, 0], b: [4, 2, 0], c: [6, 3, 1] }
    • Return a group-by on a multiple columns.

      Type Parameters

      • R extends string | number | symbol
      • IndexKey extends string

      Parameters

      Returns GroupByMultiple<T, R, IndexKey>

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, 1, 1, 2, 2, 2]),
      b: Series.new([0, 1, 2, 3, 4, 4]),
      c: Series.new([1, 2, 3, 4, 5, 6])
      })

      df.groupby({by: ['a', 'b']}).max()
      // {
      // "a_b": [{"a": [2, 1, 1, 2, 0], "b": [4, 2, 1, 3, 0]}],
      // "c": [6, 3, 2, 4, 1]
      // }
    • Return whether the DataFrame has a Series.

      Parameters

      • name: string

        Name of the Series to return.

      Returns boolean

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}),
      b: Series.new({type: new Float32, data: [0, 1, 2, 3, 4, 4]})
      });

      df.has('a') // true
      df.has('c') // false
    • Returns the first n rows as a new DataFrame.

      Parameters

      • n: number = 5

        The number of rows to return.

      Returns DataFrame<T>

      import {DataFrame, Series, Int32} from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 5, 6]}),
      b: Series.new([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
      });

      a.head();
      // {a: [0, 1, 2, 3, 4], b: [0.0, 1.0, 2.0, 3.0, 4.0]}

      b.head(1);
      // {a: [0], b: [0.0]}

      a.head(-1);
      // throws index out of bounds error
    • Type Parameters

      Parameters

      • OptionaldataType: R | null

        The dtype of the result Series (required if the DataFrame has mixed dtypes).

      • OptionalmemoryResource: MemoryResource

        An optional MemoryResource used to allocate the result's device memory.

      Returns Series<R>

      Series representing a packed row-major matrix of all the source DataFrame's Series.

      import {DataFrame, Series}  from '@rapidsai/cudf';

      new DataFrame({
      a: Series.new([1, 2, 3]),
      b: Series.new([4, 5, 6]),
      }).interleaveColumns()
      // Float64Series [
      // 1, 4, 2, 5, 3, 6
      // ]

      new DataFrame({
      b: Series.new([ [0, 1, 2], [3, 4, 5], [6, 7, 8]]),
      c: Series.new([[10, 11, 12], [13, 14, 15], [16, 17, 18]]),
      }).interleaveColumns()
      // ListSeries [
      // [0, 1, 2],
      // [10, 11, 12],
      // [3, 4, 5],
      // [13, 14, 15],
      // [6, 7, 8],
      // [16, 17, 18],
    • Creates a DataFrame replacing any FloatSeries with a Bool8Series where true indicates the value is NaN and false indicates the value is valid.

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns DataFrame<T>

      a DataFrame replacing instances of FloatSeries with a Bool8Series where true indicates the value is NaN

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, null]}),
      b: Series.new({type: new Float32, data: [0, NaN, 2]})
      });

      df.isNaN()
      // return {
      // a: [0, 1, null],
      // b: [false, true, false],
      // }
    • Creates a DataFrame replacing any FloatSeries with a Bool8Series where false indicates the value is NaN and true indicates the value is valid.

      Returns DataFrame<T>

      a DataFrame replacing instances of FloatSeries with a Bool8Series where false indicates the value is NaN

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, null]}),
      b: Series.new({type: new Float32, data: [0, NaN, 2]})
      });

      df.isNotNaN()
      // return {
      // a: [0, 1, null],
      // b: [true, false, true],
      // }
    • Creates a DataFrame of BOOL8 Series where false indicates the value is null and true indicates the value is valid.

      Returns DataFrame<{ [P in string | number | symbol]: Bool8 }>

      a DataFrame containing Series of 'BOOL8' where 'false' indicates the value is null

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, null, 2]),
      b: Series.new(['foo', 'bar', null])
      });

      df.isNotNull()
      // return {
      // a: [true, false, true],
      // b: [true, true, false],
      // }
    • Creates a DataFrame of BOOL8 Series where true indicates the value is null and false indicates the value is valid.

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns DataFrame<{ [P in string | number | symbol]: Bool8 }>

      a DataFrame containing Series of 'BOOL8' where 'true' indicates the value is null

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, null, 2]),
      b: Series.new(['foo', 'bar', null])
      });

      df.isNull()
      // return {
      // a: [false, true, false],
      // b: [false, false, true],
      // }
    • Join columns with other DataFrame.

      Type Parameters

      • R extends TypeMap
      • TOn extends string
      • LSuffix extends string = ""
      • RSuffix extends string = ""

      Parameters

      • props: JoinProps<R, TOn, "left" | "right" | "inner" | "outer", LSuffix, RSuffix>

        the configuration for the join

      Returns DataFrame<
          {
              [P in string
              | number
              | symbol]: (
                  P extends TOn
                      ? CommonType<T[P], R[P]>
                      : JoinResult<T, R, TOn, LSuffix, RSuffix>[P]
              ) & DataType
          },
      >

      the joined DataFrame

    • Join columns with other DataFrame.

      Type Parameters

      • R extends TypeMap
      • TOn extends string

      Parameters

      • props: JoinProps<R, TOn, "leftsemi" | "leftanti">

        the configuration for the join

      Returns DataFrame<T>

      the joined DataFrame

    • Return a Series containing the unbiased kurtosis result for each Series in the DataFrame.

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • skipNulls: boolean = true

        Exclude NA/null values. If an entire row/column is NA, the result will be NA.

      Returns Series<T[P] extends Numeric ? Numeric : never>

      A Series containing the unbiased kurtosis result for all Series in the DataFrame

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([1, 2, 3, 4]),
      b: Series.new([7, 8, 9, 10])
      });
      df.kurtosis(); // {-1.1999999999999904, -1.2000000000000686}
    • Compute the natural logarithm (base e) for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5, 4])
      });
      df.log();
      // return {
      // a: [NaN, 0.9162907318741551, 1.3862943611198906],
      // }
    • Convert NaNs (if any) to nulls.

      Parameters

      • Optionalsubset: (keyof T)[]

        List of float columns to consider to replace NaNs with nulls.

      • OptionalmemoryResource: MemoryResource

      Returns DataFrame<T>

      DataFrame with NaNs(if any) converted to nulls

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 4]}),
      b: Series.new({type: new Float32, data: [0, NaN, 2, 3, 4, 4]})
      });
      df.get("b").nullCount; // 0
      const df1 = df.nansToNulls();
      df1.get("b").nullCount; // 1
    • Compute the logical not (!) for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([0, 1, 2, 3, 4])
      });
      df.not();
      // return {
      // a: [true, false, false, false, false],
      // }
    • Generate an ordering that sorts DataFrame columns in a specified way

      Type Parameters

      • R extends string | number | symbol

      Parameters

      • options: { [P in string | number | symbol]: OrderSpec }

        mapping of column names to sort order specifications

      • OptionalmemoryResource: MemoryResource

        An optional MemoryResource used to allocate the result's device memory.

      Returns Int32Series

      Series containting the permutation indices for the desired sort order

      import {DataFrame, Series, Int32, NullOrder}  from '@rapidsai/cudf';
      const df = new DataFrame({a: Series.new([null, 4, 3, 2, 1, 0])});

      df.orderBy({a: {ascending: true, null_order: 'before'}});
      // Int32Series [0, 5, 4, 3, 2, 1]

      df.orderBy({a: {ascending: true, null_order: 'after'}});
      // Int32Series [5, 4, 3, 2, 1, 0]

      df.orderBy({a: {ascending: false, null_order: 'before'}});
      // Int32Series [1, 2, 3, 4, 5, 0]

      df.orderBy({a: {ascending: false, null_order: 'after'}});
      // Int32Series [0, 1, 2, 3, 4, 5]
    • Return a new DataFrame with specified columns renamed.

      Type Parameters

      • U extends string | number
      • P extends { [K in string | number | symbol]?: U }

      Parameters

      • nameMap: P

        Object mapping old to new Column names.

      Returns DataFrame<
          {
              [P in string
              | number
              | symbol]: P extends keyof {
                  [K in string
                  | number
                  | symbol as `${NonNullable<P[K]>}`]: T[string & K]
              }
                  ? {
                      [K in string
                      | number
                      | symbol as `${NonNullable<P[K]>}`]: T[string & K]
                  }[P]
                  : P extends Exclude<keyof T, string & keyof P>
                      ? { [P in string | number | symbol]: T[P] }[P]
                      : never
          },
      >

      import {DataFrame, Series, Int32, Float32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 1, 2, 2, 2]}),
      b: Series.new({type: new Float32, data: [0, 1, 2, 3, 4, 4]})
      });

      df.rename({a: 'c'}) // returns df {b: [0, 1, 2, 3, 4, 4], c: [0, 1, 1, 2, 2, 2]}
    • Replace null values with a value.

      Type Parameters

      Parameters

      • value: R["scalarType"]

        The scalar value to use in place of nulls.

      • OptionalmemoryResource: MemoryResource

        The optional MemoryResource used to allocate the result Column's device memory.

      Returns DataFrame<T>

      import {DataFrame, Series} from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([0, null, 2]);
      b: Series.new([null, null, null]);
      });

      df.replaceNulls(1);
      // return {
      // a: [0, 1, 2],
      // b: [1, 1, 1],
      // }
    • Replace null values with the corresponding elements from another Map of Series.

      Parameters

      • value: SeriesMap<T>

        The map of Series to use in place of nulls.

      • OptionalmemoryResource: MemoryResource

        The optional MemoryResource used to allocate the result Column's device memory.

      Returns DataFrame<T>

      import {DataFrame, Series} from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([0, null, 2]);
      b: Series.new([null, null, null]);
      });

      df.replaceNulls({'a': Series.new([0, 1, 2]), 'b': Series.new([1, 1, 1])});
      // return {
      // a: [0, 1, 2],
      // b: [1, 1, 1],
      // }
    • Return a new DataFrame containing only specified columns.

      Type Parameters

      • R extends string | number | symbol

      Parameters

      • names: readonly R[]

      Returns DataFrame<{ [P in string | number | symbol]: T[P] }>

      import {DataFrame, Series}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([0, 1, 1, 2, 2, 2]),
      b: Series.new([0, 1, 2, 3, 4, 4]),
      c: Series.new([1, 2, 3, 4, 5, 6])
      })

      df.select(['a', 'b']) // returns df with {a, b}
    • Compute the trigonometric sine for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.sin();
      // return {
      // a: [0, 0, 0],
      // }
    • Compute the hyperbolic sine for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.sinh();
      // return {
      // a: [-10, 0, 10],
      // }
    • Return a Series containing the unbiased skew result for each Series in the DataFrame.

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • skipNulls: boolean = true

        Exclude NA/null values. If an entire row/column is NA, the result will be NA.

      Returns Series<T[P] extends Numeric ? Numeric : never>

      A Series containing the unbiased skew result for all Series in the DataFrame

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([1, 2, 3, 4, 5, 6, 6]),
      b: Series.new([7, 8, 9, 10, 11, 12, 12])
      });
      df.skew(); // {-0.288195490292614, -0.2881954902926153}
    • Generate a new DataFrame sorted in the specified way.

      Type Parameters

      • R extends string | number | symbol

      Parameters

      • options: { [P in string | number | symbol]: OrderSpec }
      • OptionalmemoryResource: MemoryResource

      Returns DataFrame<T>

      A new DataFrame of sorted values

      import {DataFrame, Series, Int32}  from '@rapidsai/cudf';
      const df = new DataFrame({
      a: Series.new([null, 4, 3, 2, 1, 0]),
      b: Series.new([0, 1, 2, 3, 4, 5])
      });

      df.sortValues({a: {ascending: true, null_order: 'after'}})
      // {a: [0, 1, 2, 3, 4, null], b: [5, 4, 3, 2, 1, 0]}

      df.sortValues({a: {ascending: true, null_order: 'before'}})
      // {a: [null, 0, 1, 2, 3, 4], b: [0, 5, 4, 3, 2, 1]}

      df.sortValues({a: {ascending: false, null_order: 'after'}})
      // {a: [4, 3, 2, 1, 0, null], b: [1, 2, 3, 4, 5, 0]}

      df.sortValues({a: {ascending: false, null_order: 'before'}})
      // {a: [null, 4, 3, 2, 1, 0], b: [0, 1, 2, 3, 4, 5]}
    • Compute the square-root (x^0.5) for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([-1.2, 2.5, 4])
      });
      df.sqrt();
      // return {
      // a: [NaN, 1.5811388300841898, 2],
      // }
    • Compute the sum for all Series in the DataFrame.

      Type Parameters

      • P extends string | number | symbol = keyof T

      Parameters

      • Optionalsubset: readonly P[]

        List of columns to select (all columns are considered by default).

      • skipNulls: boolean = true

        The optional skipNulls if true drops NA and null values before computing reduction, else if skipNulls is false, reduction is computed directly.

      • OptionalmemoryResource: MemoryResource

        Memory resource used to allocate the result Column's device memory.

      Returns Series<
          T[P] extends Integral
              ? any[any] extends FloatingPoint ? never : Integral
              : T[P] extends FloatingPoint ? FloatingPoint : never,
      >

      A Series containing the sum of all values for each Series

      import {DataFrame, Series}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new([1, 2]),
      b: Series.new([3.5, 4])
      });
      df.sum(); // [3, 7.5]

      const df2 = new DataFrame({
      a: Series.new(['foo', 'bar']),
      b: Series.new([3, 4])
      });

      df2.sum(); // returns `never`
    • Returns the last n rows as a new DataFrame.

      Parameters

      • n: number = 5

        The number of rows to return.

      Returns DataFrame<T>

      import {DataFrame, Series, Int32} from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int32, data: [0, 1, 2, 3, 4, 5, 6]}),
      b: Series.new([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
      });

      a.tail();
      // {a: [2, 3, 4, 5, 6], b: [2.0, 3.0, 4.0, 5.0, 6.0]}

      b.tail(1);
      // {a: [6], b: [6.0]}

      a.tail(-1);
      // throws index out of bounds error
    • Compute the trigonometric tangent for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.tan();
      // return {
      // a: [0, 0, 0],
      // }
    • Compute the hyperbolic tangent for all NumericSeries in the DataFrame

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • OptionalmemoryResource: MemoryResource

      Returns T[P] extends Numeric ? DataFrame<T> : never

      A DataFrame with the operation performed on all NumericSeries

      import {DataFrame, Series, Int8}  from '@rapidsai/cudf';

      const df = new DataFrame({
      a: Series.new({type: new Int8, data: [-3, 0, 3]})
      });
      df.tanh();
      // return {
      // a: [0, 0, 0],
      // }
    • Copy a Series to an Arrow vector in host memory

      Returns Table<T>

      import {DataFrame, Series} from "@rapidsai/cudf";

      const df = new DataFrame({a: Series.new([0,1,2]), b: Series.new(["one", "two", "three"])});

      const arrow_df = df.toArrow(); // Arrow table

      arrow_df.toArray();
      // [
      // { "a": 0, "b": "one" },
      // { "a": 1, "b": "two" },
      // { "a": 2, "b": "three" }
      // ]
    • Write a DataFrame to ORC format.

      Parameters

      • filePath: string

        File path or root directory path.

      • options: WriteORCOptions = {}

        Options controlling ORC writing behavior.

      Returns void

    • Write a DataFrame to Parquet format.

      Parameters

      • filePath: string

        File path or root directory path.

      • options: WriteParquetOptions = {}

        Options controlling Parquet writing behavior.

      Returns void

    • Return a string with a tabular representation of the DataFrame, pretty-printed according to the options given.

      Parameters

      • options: DisplayOptions = {}

      Returns string

    • Read a CSV file from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      Returns DataFrame<T>

      import * as cudf  from '@rapidsai/cudf';
      const df = cudf.DataFrame.readCSV('test.csv', {
      header: 0,
      dataTypes: {
      a: new cudf.Int16,
      b: new cudf.Bool,
      c: new cudf.Float32,
      d: new cudf.Utf8String
      }
      })
    • Read a CSV file from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      Returns DataFrame<T>

      import {DataFrame, Series, Int16, Bool, Float32, Utf8String}  from '@rapidsai/cudf';
      const df = DataFrame.readCSV({
      header: 0,
      sourceType: 'files',
      sources: ['test.csv'],
      dataTypes: {
      a: new Int16,
      b: new Bool,
      c: new Float32,
      d: new Utf8String
      }
      })
    • Read Apache ORC files from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      • paths: string | string[]
      • Optionaloptions: ReadORCOptionsCommon

      Returns DataFrame<T>

      import {DataFrame}  from '@rapidsai/cudf';
      const df = DataFrame.readORC('test.orc', {
      skipRows: 10, numRows: 10,
      })
    • Read Apache ORC files from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      • options: ReadORCOptions

      Returns DataFrame<T>

      import {DataFrame}  from '@rapidsai/cudf';
      const df = DataFrame.readORC({
      sourceType: 'files',
      sources: ['test.orc'],
      })
    • Read Apache Parquet files from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      • paths: string | string[]
      • Optionaloptions: ReadParquetOptionsCommon

      Returns DataFrame<T>

      import {DataFrame}  from '@rapidsai/cudf';
      const df = DataFrame.readParquet('test.parquet', {
      skipRows: 10, numRows: 10,
      })
    • Read Apache Parquet files from disk and create a cudf.DataFrame

      Type Parameters

      Parameters

      • options: ReadParquetOptions

      Returns DataFrame<T>

      import {DataFrame}  from '@rapidsai/cudf';
      const df = DataFrame.readParquet({
      sourceType: 'files',
      sources: ['test.parquet'],
      })