Skip to content

csv module

Module with CSVData.


CSVData class

CSVData(
    wrapper,
    data,
    single_key=True,
    classes=None,
    level_name=None,
    fetch_kwargs=None,
    returned_kwargs=None,
    last_index=None,
    delisted=None,
    tz_localize=None,
    tz_convert=None,
    missing_index=None,
    missing_columns=None,
    **kwargs
)

Data class for fetching CSV data.

Superclasses

Inherited members


fetch_feature class method

CSVData.fetch_feature(
    feature,
    **kwargs
)

Fetch the CSV file of a feature.

Uses CSVData.fetch_key().


fetch_key class method

CSVData.fetch_key(
    key,
    path=None,
    start=None,
    end=None,
    tz=None,
    start_row=None,
    end_row=None,
    header=None,
    index_col=None,
    parse_dates=None,
    chunk_func=None,
    squeeze=None,
    **read_kwargs
)

Fetch the CSV file of a feature or symbol.

Args

key : hashable
Feature or symbol.
path : str

Path.

If path is None, uses key as the path to the CSV file.

start : any

Start datetime.

Will use the timezone of the object. See to_timestamp().

end : any

End datetime.

Will use the timezone of the object. See to_timestamp().

tz : any

Target timezone.

See to_timezone().

start_row : int

Start row (inclusive).

Must exclude header rows.

end_row : int

End row (exclusive).

Must exclude header rows.

header : int or sequence of int
See pd.read_csv.
index_col : int

See pd.read_csv.

If False, will pass None.

parse_dates : bool
See pd.read_csv.
chunk_func : callable

Function to select and concatenate chunks from TextFileReader.

Gets called only if iterator or chunksize are set.

squeeze : int
Whether to squeeze a DataFrame with one column into a Series.
**read_kwargs
Other keyword arguments passed to pd.read_csv.

skiprows and nrows will be automatically calculated based on start_row and end_row.

When either start or end is provided, will fetch the entire data first and filter it thereafter.

See https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html for other arguments.

For defaults, see custom.csv in data.


fetch_symbol class method

CSVData.fetch_symbol(
    symbol,
    **kwargs
)

Fetch the CSV file of a symbol.

Uses CSVData.fetch_key().


is_csv_file class method

CSVData.is_csv_file(
    path
)

Return whether the path is a CSV/TSV file.


update_feature method

CSVData.update_feature(
    feature,
    **kwargs
)

Update data of a feature.

Uses CSVData.update_key() with key_is_feature=True.


update_key method

CSVData.update_key(
    key,
    key_is_feature=False,
    **kwargs
)

Update data of a feature or symbol.


update_symbol method

CSVData.update_symbol(
    symbol,
    **kwargs
)

Update data for a symbol.

Uses CSVData.update_key() with key_is_feature=False.