diff --git a/dskit/io.py b/dskit/io.py index 818e1e5..6b1cfc4 100644 --- a/dskit/io.py +++ b/dskit/io.py @@ -29,23 +29,8 @@ def load(filepath): def read_folder(folder_path:str, file_type:str='csv',dynamic:bool=False,display_ignored:bool=False): """ - Load and concatenate tabular files from a folder. - Parameters - ---------- - folder_path : str - Path to the directory containing the files to be loaded. - - file_type : str, default='csv' - File extension to filter files when `dynamic=False`. - Example: 'csv', 'xlsx', 'parquet'. - - dynamic : bool, default=False - If True, loads all files regardless of extension. - If False, only files matching `file_type` are loaded. - - display_ignored : bool, default=False - If True, prints the list of files that were skipped - because they could not be loaded by the `load()` function. + Load multiple files from a folder and return + a list of pandas DataFrames. """ if not os.path.exists(folder_path): raise FileNotFoundError(f"The folder '{folder_path}' was not found.") @@ -71,7 +56,7 @@ def read_folder(folder_path:str, file_type:str='csv',dynamic:bool=False,display_ if display_ignored: print("Ignored Files : ","\n".join(ignored)) if df_list: - return pd.concat(df_list, ignore_index=True) + return df_list else: return None