Skip to content

Commit

Permalink
fix(datasets/load): support pathlib.Path in data_file argument
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Aug 10, 2023
1 parent e83f184 commit 254e975
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hyfi/utils/datasets/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import os
from typing import Dict, Mapping, Optional, Sequence, Union
from pathlib import Path

import datasets as hfds
import pandas as pd
Expand Down Expand Up @@ -136,7 +137,7 @@ def load_dataframes(

@staticmethod
def load_dataframe(
data_file: str,
data_file: Union[str, Path],
data_dir: Optional[str] = None,
filetype: Optional[str] = None,
columns: Optional[Sequence[str]] = None,
Expand All @@ -150,6 +151,7 @@ def load_dataframe(
dtype = {k: "str" for k in dtype}
parse_dates = kwargs.pop("parse_dates", False)

data_file = str(data_file)
if data_file.startswith("http"):
filepath = data_file
else:
Expand Down

0 comments on commit 254e975

Please sign in to comment.