Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataFrame<T>

A GPU Dataframe object.

Type parameters

Hierarchy

  • DataFrame

Index

Constructors

constructor

  • Create a new cudf.DataFrame

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

    Type parameters

    Parameters

    Returns DataFrame<T>

  • Create a new cudf.DataFrame

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

    Type parameters

    Parameters

    Returns DataFrame<T>

  • Create a new cudf.DataFrame

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

    Type parameters

    Parameters

    • Optional data: ColumnAccessor<T>

    Returns DataFrame<T>

Accessors

names

  • get names(): readonly (string & keyof T)[]
  • The names of columns in this DataFrame

    example
    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']

    Returns readonly (string & keyof T)[]

numColumns

  • get numColumns(): number
  • The number of columns in this DataFrame

    example
    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

    Returns number

numRows

  • get numRows(): number
  • The number of rows in each column of this DataFrame

    example
    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

    Returns number

types

  • get types(): T
  • A map of this DataFrame's Series names to their DataTypes

    example
    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]
    // }

    Returns T

Methods

abs

  • abs<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the absolute value for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

acos

  • acos<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric cosine inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

acosh

  • acosh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic cosine inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

asin

  • asin<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric sine inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

asinh

  • asinh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic sine inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

assign

  • assign<R>(data: SeriesMap<R> | DataFrame<R>): DataFrame<{ [ P in string | number | symbol]: P extends keyof R ? R[P] : P extends keyof T ? T[P] : never }>
  • Return a new DataFrame with new columns added.

    example
    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"]}
    example
    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"]}

    Type parameters

    Parameters

    • data: SeriesMap<R> | DataFrame<R>

      mapping of names to new columns to add, or a GPU DataFrame object

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

atan

  • atan<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric tangent inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

atanh

  • atanh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic tangent inverse for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

cast

  • cast<R>(dataTypes: R, memoryResource?: MemoryResource): DataFrame<{ [ P in string | number | symbol]: Omit<T, keyof R> & R[P] }>
  • Casts each selected Series in this DataFrame to a new dtype (similar to static_cast in C++).

    example
    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

    Type parameters

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

    Parameters

    • dataTypes: R

      The map from column names to new dtypes.

    • Optional memoryResource: 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

castAll

  • castAll<R>(dataType: R, memoryResource?: MemoryResource): DataFrame<{ [ P in string | number | symbol]: R }>
  • 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.

    • Optional memoryResource: 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 make notebooks.run 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

    
    

cbrt

  • cbrt<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the cube-root (x^(1.0/3)) for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

ceil

  • ceil<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the smallest integer value not less than arg for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

concat

  • concat<U>(...others: U): ConcatTypeMap<DataFrame<T>, U>[keyof ConcatTypeMap<DataFrame<T>, U>] extends never ? never : DataFrame<{ [ P in string | number | symbol]: ConcatTypeMap<DataFrame<T>, U>[P] }>
  • Concat DataFrame(s) to the end of the caller, returning a new DataFrame.

    example
    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],
    // }

    Type parameters

    Parameters

    • Rest ...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] }>

cos

  • cos<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric cosine for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

cosh

  • cosh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic cosine for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

dispose

  • dispose(): void

drop

  • drop<R>(names: readonly R[]): DataFrame<{ [ P in string | number | symbol]: T[P] }>
  • Return a new DataFrame with specified columns removed.

    example
    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]}

    Type parameters

    • R: string | number | symbol

    Parameters

    • names: readonly R[]

      Names of the columns to drop.

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

dropDuplicates

  • dropDuplicates(keep?: "any" | "first" | "last" | "none", nullsEqual?: boolean, nullsFirst?: boolean, subset?: readonly (string & keyof T)[], memoryResource?: MemoryResource): DataFrame<T>
  • Drops duplicate rows from a DataFrame

    Parameters

    • keep: "any" | "first" | "last" | "none" = '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).

    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<T>

    a DataFrame without duplicate rows

    
    

dropNaNs

  • dropNaNs<R>(axis?: number, thresh?: number, subset?: (string & keyof T)[] | Series<R>): DataFrame<T>
  • Drops rows (or columns) containing NaN, provided the columns are of type float

    example
    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

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

    • Optional subset: (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

dropNulls

  • dropNulls<R>(axis?: number, thresh?: number, subset?: (string & keyof T)[] | Series<R>): DataFrame<T>
  • Drops rows (or columns) containing nulls (*Note: only null values are dropped and not NaNs)

    example
    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

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

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

      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

exp

  • exp<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the exponential (base e, euler number) for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

filter

  • Return sub-selection from a DataFrame from the specified boolean mask.

    example
    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]}

    Parameters

    • mask: Bool8Series
    • Optional memoryResource: MemoryResource

    Returns DataFrame<T>

flatten

  • flatten<R>(names?: readonly R[], includeNulls?: boolean, memoryResource?: MemoryResource): DataFrame<U>
  • summary

    Flatten the elements of this DataFrame's list columns, duplicating the corresponding rows for other columns in this DataFrame.

    Type parameters

    • R: string

    Parameters

    • names: readonly R[] = ...

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

    • includeNulls: boolean = true
    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<U>

flattenIndices

  • flattenIndices<R>(names?: readonly R[], includeNulls?: boolean, memoryResource?: MemoryResource): DataFrame<U>
  • summary

    Flatten the elements of this DataFrame's list columns into their positions in its original list, duplicating the corresponding rows for other columns in this DataFrame.

    Type parameters

    • R: string

    Parameters

    • names: readonly R[] = ...

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

    • includeNulls: boolean = true
    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<U>

floor

  • floor<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the largest integer value not greater than arg for all NumericSeries in the DataFrame

    example
    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

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

gather

  • gather<R>(selection: Series<R>, nullify_out_of_bounds?: boolean, memoryResource?: MemoryResource): DataFrame<T>
  • summary

    Return sub-selection from a DataFrame using the specified integral indices.

    description

    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.

    example
    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]}

    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.

    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<T>

get

  • Return a series by name.

    example
    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

    Type parameters

    • P: string | number | symbol

    Parameters

    • name: P

      Name of the Series to return.

    Returns Series<T[P]>

groupBy

  • Return a group-by on a single column.

    example
    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] }

    Type parameters

    • R: string | number | symbol

    Parameters

    Returns GroupBySingle<T, R>

  • Return a group-by on a multiple columns.

    example
    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]
    // }

    Type parameters

    • R: string | number | symbol

    • IndexKey: string

    Parameters

    Returns GroupByMultiple<T, R, IndexKey>

has

  • has(name: string): boolean
  • Return whether the DataFrame has a Series.

    example
    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

    Parameters

    • name: string

      Name of the Series to return.

    Returns boolean

head

  • Returns the first n rows as a new DataFrame.

    example
    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

    Parameters

    • n: number = 5

      The number of rows to return.

    Returns DataFrame<T>

interleaveColumns

  • interleaveColumns<R>(dataType?: null | R, memoryResource?: MemoryResource): Series<R>
  • summary

    Interleave columns of a DataFrame into a single Series.

    example
    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],
    // ]

    Type parameters

    Parameters

    • Optional dataType: null | R

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

    • Optional memoryResource: 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.

isNaN

  • isNaN(memoryResource?: MemoryResource): DataFrame<T>
  • Creates a DataFrame replacing any FloatSeries with a Bool8Series where true indicates the value is NaN and false indicates the value is valid.

    example
    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],
    // }

    Parameters

    • Optional memoryResource: MemoryResource

    Returns DataFrame<T>

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

isNotNaN

  • Creates a DataFrame replacing any FloatSeries with a Bool8Series where false indicates the value is NaN and true indicates the value is valid.

    example
    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],
    // }

    Returns DataFrame<T>

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

isNotNull

  • Creates a DataFrame of BOOL8 Series where false indicates the value is null and true indicates the value is valid.

    example
    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],
    // }

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

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

isNull

  • isNull(memoryResource?: MemoryResource): DataFrame<{ [ P in string | number | symbol]: Bool8 }>
  • Creates a DataFrame of BOOL8 Series where true indicates the value is null and false indicates the value is valid.

    example
    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],
    // }

    Parameters

    • Optional memoryResource: MemoryResource

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

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

join

  • join<R, TOn, LSuffix, RSuffix>(props: JoinProps<R, TOn, "left" | "right" | "inner" | "outer", LSuffix, RSuffix>): DataFrame<{ [ P in string | number | symbol]: P extends TOn ? CommonType<T[P], R[P]> : JoinResult<T, R, TOn, LSuffix, RSuffix>[P] }>
  • join<R, TOn>(props: JoinProps<R, TOn, "leftsemi" | "leftanti", "", "">): DataFrame<T>
  • Join columns with other DataFrame.

    Type parameters

    • R: TypeMap

    • TOn: string

    • LSuffix: string = ""

    • RSuffix: 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] }>

    the joined DataFrame

  • Join columns with other DataFrame.

    Type parameters

    Parameters

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

      the configuration for the join

    Returns DataFrame<T>

    the joined DataFrame

kurtosis

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

    example
    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}

    Type parameters

    • P: 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

log

  • log<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the natural logarithm (base e) for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

nansToNulls

  • nansToNulls(subset?: keyof T[], memoryResource?: MemoryResource): DataFrame<T>
  • Convert NaNs (if any) to nulls.

    example
    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

    Parameters

    • Optional subset: keyof T[]

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

    • Optional memoryResource: MemoryResource

    Returns DataFrame<T>

    DataFrame with NaNs(if any) converted to nulls

not

  • not<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the logical not (!) for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

orderBy

  • orderBy<R>(options: { [ P in string | number | symbol]: OrderSpec }, memoryResource?: MemoryResource): Int32Series
  • Generate an ordering that sorts DataFrame columns in a specified way

    example
    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]

    Type parameters

    • R: string | number | symbol

    Parameters

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

      mapping of column names to sort order specifications

    • Optional memoryResource: MemoryResource

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

    Returns Int32Series

    Series containting the permutation indices for the desired sort order

rename

  • rename<U, P>(nameMap: P): 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 }>
  • Return a new DataFrame with specified columns renamed.

    example
    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]}

    Type parameters

    • U: string | number

    • P: { [ 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 }>

replaceNulls

  • replaceNulls<R>(value: R["scalarType"], memoryResource?: MemoryResource): DataFrame<T>
  • replaceNulls(value: SeriesMap<T>, memoryResource?: MemoryResource): DataFrame<T>
  • Replace null values with a value.

    example
    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],
    // }

    Type parameters

    Parameters

    • value: R["scalarType"]

      The scalar value to use in place of nulls.

    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<T>

  • Replace null values with the corresponding elements from another Map of Series.

    example
    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],
    // }

    Parameters

    • value: SeriesMap<T>

      The map of Series to use in place of nulls.

    • Optional memoryResource: MemoryResource

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

    Returns DataFrame<T>

select

  • select<R>(names: readonly R[]): DataFrame<{ [ P in string | number | symbol]: T[P] }>
  • Return a new DataFrame containing only specified columns.

    example
    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}

    Type parameters

    • R: string | number | symbol

    Parameters

    • names: readonly R[]

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

sin

  • sin<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric sine for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

sinh

  • sinh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic sine for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

skew

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

    example
    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}

    Type parameters

    • P: 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

sortValues

  • sortValues<R>(options: { [ P in string | number | symbol]: OrderSpec }, memoryResource?: MemoryResource): DataFrame<T>
  • Generate a new DataFrame sorted in the specified way.

    example
    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]}

    Type parameters

    • R: string | number | symbol

    Parameters

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

    Returns DataFrame<T>

    A new DataFrame of sorted values

sqrt

  • sqrt<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the square-root (x^0.5) for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

sum

  • Compute the sum for all Series in the DataFrame.

    example
    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`

    Type parameters

    • P: string | number | symbol = keyof T

    Parameters

    • Optional subset: 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.

    • Optional memoryResource: 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

tail

  • Returns the last n rows as a new DataFrame.

    example
    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

    Parameters

    • n: number = 5

      The number of rows to return.

    Returns DataFrame<T>

tan

  • tan<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the trigonometric tangent for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

tanh

  • tanh<P>(memoryResource?: MemoryResource): T[P] extends Numeric ? DataFrame<T> : never
  • Compute the hyperbolic tangent for all NumericSeries in the DataFrame

    example
    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],
    // }

    Type parameters

    • P: string | number | symbol

    Parameters

    • Optional memoryResource: MemoryResource

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

    A DataFrame with the operation performed on all NumericSeries

toArrow

  • toArrow(): Table<T>
  • Copy a Series to an Arrow vector in host memory

    example
    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" }
    // ]

    Returns Table<T>

toCSV

toORC

  • toORC(filePath: string, options?: WriteORCOptions): void
  • Write a DataFrame to ORC format.

    Parameters

    • filePath: string

      File path or root directory path.

    • options: WriteORCOptions = {}

      Options controlling ORC writing behavior.

    Returns void

toParquet

  • toParquet(filePath: string, options?: WriteParquetOptions): 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

toString

  • toString(options?: DisplayOptions): string
  • Return a string with a tabular representation of the DataFrame, pretty-printed according to the options given.

    Parameters

    • options: DisplayOptions = {}

    Returns string

Static fromArrow

  • fromArrow<T>(memory: MemoryData | DeviceBuffer): DataFrame<T>

Static fromTable

  • fromTable<T>(table: Table, names: readonly (string & keyof T)[]): DataFrame<T>

Static readCSV

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

    example
    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
    }
    })

    Type parameters

    Parameters

    Returns DataFrame<T>

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

    example
    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
    }
    })

    Type parameters

    Parameters

    Returns DataFrame<T>

Static readORC

  • readORC<T>(paths: string | string[], options?: ReadORCOptionsCommon): DataFrame<T>
  • readORC<T>(options: ReadORCOptions): DataFrame<T>
  • Read Apache ORC files from disk and create a cudf.DataFrame

    example
    import {DataFrame}  from '@rapidsai/cudf';
    const df = DataFrame.readORC('test.orc', {
    skipRows: 10, numRows: 10,
    })

    Type parameters

    Parameters

    • paths: string | string[]
    • Optional options: ReadORCOptionsCommon

    Returns DataFrame<T>

  • Read Apache ORC files from disk and create a cudf.DataFrame

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

    Type parameters

    Parameters

    • options: ReadORCOptions

    Returns DataFrame<T>

Static readParquet

  • readParquet<T>(paths: string | string[], options?: ReadParquetOptionsCommon): DataFrame<T>
  • readParquet<T>(options: ReadParquetOptions): DataFrame<T>
  • Read Apache Parquet files from disk and create a cudf.DataFrame

    example
    import {DataFrame}  from '@rapidsai/cudf';
    const df = DataFrame.readParquet('test.parquet', {
    skipRows: 10, numRows: 10,
    })

    Type parameters

    Parameters

    • paths: string | string[]
    • Optional options: ReadParquetOptionsCommon

    Returns DataFrame<T>

  • Read Apache Parquet files from disk and create a cudf.DataFrame

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

    Type parameters

    Parameters

    • options: ReadParquetOptions

    Returns DataFrame<T>