Skip to main content
Version: Python


The read_csv method will read a CSV file into an in-memory table.


from deephaven import read_csv

read_csv(path: str,
header: Dict[str, DataType]=None,
headless: bool=False,
delimiter: str=",",
quote: str="\"",
ignore_surrounding_spaces: bool = True,
trim: bool = False,
charset: str = "utf-8")



The file to load into a table.

header optionalDict

Define a dictionary for the header and the data type: [str, DataType]. Default is None.

headless optionalboolean
  • False (default) - first row contains header information.
  • True - first row is included in your dataset.
delimiter optionalchar

The delimiter for the file.

  • <delimiter> is the delimiter being used by the text file. Any non-newline string can be specified (i.e.,,, ;, :, \, |, etc.).
  • The default is ,.
quote optionalchar

The char surrounding a string value. Default is \".

ignore_surrounding_spaces optionalboolean

Trim leading and trailing blanks from non-quoted values. Default is True.

trim optionalboolean

Trim leading and trailing blanks from inside quoted values. Default is False.

charset optionalString

The character set. Default is utf-8.

csvSpecs optionalCsvSpecs

Specifications for how to load the CSV file.


Only one format parameter can be used at a time.


A new in-memory table from a CSV file.



In this guide, we read data from locations relative to the base of the Docker container. See Docker data volumes to learn more about the relation between locations in the container and the local file system.

In the following example, write_csv writes the source table to /data/file.csv, and read_csv loads the file into a Deephaven table.

from deephaven import new_table
from deephaven.column import string_col, int_col, double_col
from deephaven import read_csv, write_csv
from deephaven.constants import NULL_INT

source = new_table([
string_col("X", ["A", "B", None, "C", "B", "A", "B", "B", "C"]),
int_col("Y", [2, 4, 2, 1, 2, 3, 4, NULL_INT, 3]),
int_col("Z", [55, 76, 20, NULL_INT, 230, 50, 73, 137, 214]),

write_csv(source, "/data/file.csv")

result = read_csv("/data/file.csv")

In the following examples, the example data found in Deephaven's example repository will be used. Follow the instructions in the README to download the data to the proper location for use with Deephaven.

In the following example, read_csv is used to load the file DeNiro CSV into a Deephaven table.

from deephaven import read_csv
result = read_csv("")
from deephaven import read_csv

deniroTSV = read_csv("", delimiter="\t")

Any character can be used as a delimiter. The pipe character (|) is common. In the following example, the second input parameter is used to read a pipe-delimited file into memory.

from deephaven import read_csv

result = read_csv("", delimiter="|")