5.3. Table Loader Factory Classes¶
5.3.1. File Loader Factory¶
- class pytablereader.factory.TableFileLoaderFactory(source, encoding=None)[source]¶
- Parameters
file_path (str) – Path to the loading file.
- Raises
pytablereader.InvalidFilePathError – If the
file_path
is an empty path.
- create_from_format_name(format_name)[source]¶
Create a file loader from a format name. Supported file formats are as follows:
Format name
Loader
"csv"
"excel"
"html"
"json"
"json"
"json_lines"
"jsonl"
"ltsv"
"markdown"
"mediawiki"
"ndjson"
"sqlite"
"ssv"
"tsv"
TsvTableFileLoader
- Parameters
format_name (str) – Format name string (case insensitive).
- Returns
Loader that coincides with the
format_name
:- Raises
pytablereader.LoaderNotFoundError – If an appropriate loader not found for the format.
- create_from_path()[source]¶
Create a file loader from the file extension to loading file. Supported file extensions are as follows:
Extension
Loader
"csv"
"xls"
/"xlsx"
"htm"
/"html"
"json"
"jsonl"
"ldjson"
"ltsv"
"md"
"ndjson"
"sqlite"
/"sqlite3"
"tsv"
TsvTableFileLoader
- Returns
Loader that coincides with the file extension of the
file_extension
.- Raises
pytablereader.LoaderNotFoundError – If an appropriate loader not found for loading the file.
- get_extension_list()¶
- get_format_name_list()¶
- property source¶
Data source to load. :rtype: str
- Type
return
5.3.2. Text Loader Factory¶
- class pytablereader.factory.TableTextLoaderFactory(source, encoding=None)[source]¶
- create_from_format_name(format_name)[source]¶
Create a file loader from a format name. Supported file formats are as follows:
Format name
Loader
"csv"
"html"
"json"
"json_lines"
"jsonl"
"ldjson"
"ltsv"
"markdown"
"mediawiki"
"ndjson"
"ssv"
"tsv"
TsvTableTextLoader
- Parameters
format_name (str) – Format name string (case insensitive).
- Returns
Loader that coincide with the
format_name
:- Raises
pytablereader.LoaderNotFoundError – If an appropriate loader not found for the format.
TypeError – If
format_name
is not a string.
- get_extension_list()¶
- get_format_name_list()¶
- property source¶
Data source to load. :rtype: str
- Type
return
5.3.3. Url Loader Factory¶
- class pytablereader.factory.TableUrlLoaderFactory(url, encoding=None, proxies=None)[source]¶
- create_from_format_name(format_name)[source]¶
Create a file loader from a format name. Supported file formats are as follows:
Format name
Loader
"csv"
"excel"
"html"
"json"
"json_lines"
"jsonl"
"ldjson"
"ltsv"
"markdown"
"mediawiki"
"ndjson"
"sqlite"
"ssv"
"tsv"
TsvTableTextLoader
- Parameters
format_name (str) – Format name string (case insensitive).
- Returns
Loader that coincide with the
format_name
:- Raises
pytablereader.LoaderNotFoundError – If an appropriate loader not found for the format.
TypeError – If
format_name
is not a string.
- create_from_path()[source]¶
Create a file loader from the file extension to loading file. Supported file extensions are as follows:
Extension
Loader
"csv"
"xls"
/"xlsx"
"htm"
/"html"
/"asp"
/"aspx"
"json"
"jsonl"
/"ldjson"
/"ndjson"
"ltsv"
"md"
"sqlite"
/"sqlite3"
"tsv"
TsvTableTextLoader
- Returns
Loader that coincides with the file extension of the URL.
- Raises
pytablereader.UrlError – If unacceptable URL format.
pytablereader.LoaderNotFoundError – If an appropriate loader not found for loading the URL.
- get_extension_list()¶
- get_format_name_list()¶
- property source¶
Data source to load. :rtype: str
- Type
return