read_csv¶
petrophys.io.read_csv
- read_csv(
- filepath,
- depth_column='DEPTH',
- depth_unit=None,
- well_name='',
- skiprows=0,
- null_values=None,
- well_column=None,
- **kwargs,
Read CSV file and return Well object.
- Parameters:
filepath (str or Path) – Path to CSV file
depth_column (str, optional) – Name of depth column (default: “DEPTH”); a header with a unit,
DEPTH (m)orDEPTH [m], is found by its namedepth_unit ({"m", "ft"}) – Unit of the depth column. Required unless the depth column header gives it (
DEPTH (m)); when both are given they must agree.well_name (str, optional) – Name for the well
skiprows (int, optional) – Number of rows to skip at start
null_values (scalar or list, optional) – Further null values (e.g.
-99999) besides -999, -999.25, -9999, -9999.25, “null” and “NaN”well_column (str, optional) – Column identifying the well (default: the first of WELL, WELLNAME, WELL_NAME, UWI and API present). It is read as text, so identifiers keep their leading zeros, names the well and is not a curve; a UWI or API column also sets
header.uwiorheader.api.**kwargs – Additional arguments passed to pd.read_csv (e.g.
sep=";",decimal=","orthousands=","). Withoutsep, a header line that a semicolon or a tab splits into more columns than a comma does gives the separator; withoutdecimalandthousands, a semicolon- or tab-separated file whose first rows write numbers as2000,5and none as2000.5is read with decimal commas.
- Returns:
Well object with loaded data. A column header
NAME (unit)orNAME [unit], asexport_csv()writes, gives curveNAMEwith that unit.- Return type:
- Raises:
ValueError – If the depth column is missing or has no numeric value, two columns become the same curve name (they differ only in case or unit), or the depth header’s unit differs from
depth_unit.
Examples
>>> from petrophys.io import read_csv >>> well = read_csv("well_data.csv", depth_column="MD", depth_unit="m")