secretflow.data.io#

secretflow.data.io.oss#

Functions:

s3fs()

Return a s3 filesystem instance.

open(path[, mode])

Open a oss object.

secretflow.data.io.oss.s3fs()[源代码]#

Return a s3 filesystem instance.

secretflow.data.io.oss.open(path, mode='rb')[源代码]#

Open a oss object.

参数:
  • path – oss file path.

  • mode – optional; open mode.

返回:

A file-like object.

secretflow.data.io.util#

Functions:

open(filepath[, mode])

Open a oss/http/https file.

is_local_file(uri)

read_csv_wrapper(filepath[, ...])

A wrapper of pandas read_csv and supports oss file.

to_csv_wrapper(df, filepath, **kwargs)

A wrapper of pandas to_csv and supports oss file.

secretflow.data.io.util.open(filepath: Union[str, Path], mode='rb')[源代码]#

Open a oss/http/https file.

参数:
  • filepath – The file path, which can be an oss, or pathlib.Path object.

  • mode – optional. open mode.

返回:

the file object.

secretflow.data.io.util.is_local_file(uri: str) bool[源代码]#
secretflow.data.io.util.read_csv_wrapper(filepath: str, auto_gen_header_prefix: str = '', **kwargs) DataFrame[源代码]#

A wrapper of pandas read_csv and supports oss file.

参数:
  • filepath – the file path.

  • auto_gen_header_prefix – If set, the format of generated headers would be {gen_header_prefix}_{col_idx}.

  • kwargs – all other arguments are same with pandas.DataFrame.read_csv().

返回:

a pandas DataFrame.

secretflow.data.io.util.to_csv_wrapper(df: DataFrame, filepath, **kwargs)[源代码]#

A wrapper of pandas to_csv and supports oss file.

参数:
  • filepath – the file path.

  • kwargs – all other arguments are same with pandas.DataFrame.read_csv().

返回:

a pandas DataFrame.