pyecotaxa

Installation

pip install pyecotaxa

Reading and writing archives

Read and write EcoTaxa archives and individual EcoTaxa TSV files.

pyecotaxa.archive.read_tsv(filepath_or_buffer, encoding: str = 'utf-8-sig', enforce_types=False, usecols: Union[None, Callable, List[str]] = None, **kwargs) DataFrame

Read an individual EcoTaxa TSV file.

Parameters
  • filepath_or_buffer (str, path object or file-like object) –

  • encoding – Encoding of the TSV file. With the default “utf-8-sig”, both UTF8 and signed UTF8 can be read.

  • enforce_types – Enforce the column dtypes provided in the header. Usually, it is desirable to allow pandas to infer the column dtypes.

  • usecols – List of strings or callable.

  • **kwargs – Additional kwargs are passed to pandas:pandas.read_csv().

Returns

A Pandas DataFrame.

pyecotaxa.archive.write_tsv(dataframe: DataFrame, path_or_buf=None, encoding='utf-8', type_header=True, **kwargs)

Write an individual EcoTaxa TSV file.

Parameters
  • dataframe – A pandas DataFrame.

  • path_or_buf (str, path object or file-like object) –

  • encoding – Encoding of the TSV file. With the default “utf-8”, both UTF8 and signed UTF8 readers can read the file.

  • enforce_types – Enforce the column dtypes provided in the header. Usually, it is desirable to allow pandas to infer the column dtypes.

  • type_header (bool, default true) – Include the type header ([t]/[f]). This is required for a successful import into EcoTaxa.

Returns

None or str

If path_or_buf is None, returns the resulting csv format as a string. Otherwise returns None.