Skip to content

Data

po.data.readingdata

file_path_finder(file_name)

generates path from folder name called data and file name.

Parameters:

Name Type Description Default
file_name str

file name

required

Returns:

Name Type Description
df_dir str

directory of file

Source code in src/po/data/readingdata.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
def file_path_finder(file_name: str) -> str:
    """generates path from folder name called data and file name.

    Args:
        file_name (str): file name

    Returns:
        df_dir (str): directory of file
    """
    import glob
    import os

    main_dir = os.path.dirname(os.getcwd())
    rawdata_dir = os.path.join(main_dir, "data", file_name)
    df_dir = glob.glob(rawdata_dir)[0]
    return df_dir