Reads in an .ods/.fods file and returns a pandas DataFrame object (+ parse cell formatting)
Go to file
iuvbio c379503b1c rename modules and factor out common functionality 2021-08-22 18:05:47 +02:00
.github/workflows Update workflow 2021-08-20 19:57:50 +02:00
pandas_ods_reader rename modules and factor out common functionality 2021-08-22 18:05:47 +02:00
tests add fods tests 2021-08-20 19:14:26 +02:00
.gitignore update .gitignore 2021-08-18 22:53:48 +02:00
LICENSE.txt add license and manifest 2019-01-28 21:22:40 +01:00
MANIFEST.in add VERSION to manifest 2021-08-18 23:50:04 +02:00
README.md misc: fix README 2021-07-01 20:00:35 +03:00
setup.cfg misc: requirement ordering 2021-08-20 19:33:48 +02:00
setup.py reorganize structure 2021-08-18 23:30:13 +02:00

README.md

pandas_ods_reader

Provides a function to read in an ODS file and returns a pandas DataFrame.

It uses ezodf to read in the ods file. If a range is specified in the sheet to be imported, it seems that ezodf imports empty cells as well. Therefore, completely empty rows and columns are dropped from the DataFrame, before it is returned. Only trailing empty rows and columns are dropped.

If the ODS file contains duplicated column names, they will be numbered and the number is appended to the column name in the resulting DataFrame.

Dependencies

  • ezodf
  • lxml
  • pandas

Installation

pip install pandas_ods_reader

Usage

from pandas_ods_reader import read_ods

path = "path/to/file.ods"

# by default the first sheet is imported
df = read_ods(path)

# load a sheet based on its index (1 based)
sheet_idx = 1
df = read_ods(path, sheet_idx)

# load a sheet based on its name
sheet_name = "sheet1"
df = read_ods(path, sheet_name)

# load a file that does not contain a header row
# if no columns are provided, they will be numbered
df = read_ods(path, 1, headers=False)

# load a file and provide custom column names
# if headers is True (the default), the header row will be overwritten
df = read_ods(path, 1, columns=["A", "B", "C"])