Skip to content

read

read_csv_file(fpath)

Read CSV data file

Parameters:

Name Type Description Default
fpath str

Path of the file to read

required

Returns:

Type Description
pd.DataFrame

DataFrame containg the data of the CSV

Source code in python/posted/read.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def read_csv_file(fpath: str):
    """
    Read CSV data file

    Parameters
    ----------
    fpath: str
        Path of the file to read
    Returns
    -------
        pd.DataFrame
            DataFrame containg the data of the CSV
    """
    return pd.read_csv(fpath)

read_yml_file(fpath)

Read YAML config file

Parameters:

Name Type Description Default
fpath Path

Path of the file to read

required

Returns:

Type Description
dict

Dictionary containing config info

Source code in python/posted/read.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def read_yml_file(fpath: Path):
    """
    Read YAML config file

    Parameters
    ----------
    fpath: str
        Path of the file to read
    Returns
    -------
        dict
            Dictionary containing config info
    """
    fhandle = open(fpath, 'r', encoding='utf-8')
    ret = yaml.load(stream=fhandle, Loader=yaml.FullLoader)
    fhandle.close()
    return ret