vastorbit.pcsv¶
- vastorbit.pcsv(path: str, sep: str = ',', header: bool = True, header_names: list | None = None, na_rep: str | None = None, parse_nrows: int = 1000) dict[str, str]¶
Parse a CSV file and return inferred column types.
Supports wildcard patterns - will analyze first matching file.
- Parameters:
path (str) – Path to the CSV file(s). Supports wildcards (e.g.,
'*.csv')sep (str, optional) – Column separator (default: ‘,’)
header (bool, optional) – Whether CSV has header row (default: True)
header_names (list, optional) – Custom column names
na_rep (str, optional) – String representing missing values
parse_nrows (int, optional) – Number of rows to use for type inference (default: 1000)
- Returns:
Dictionary mapping column names to Trino types
- Return type:
dict
Examples
from vastorbit.core.parsers.csv import pcsv # Inspect single CSV types = pcsv('data.csv') # Inspect first matching CSV types = pcsv('sales_*.csv')