
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Python binding for beautiful Rust's library for reading excel and odf file - calamine.
Pypi:
pip install python-calamine
Conda:
conda install -c conda-forge python-calamine
from python_calamine import CalamineWorkbook
workbook = CalamineWorkbook.from_path("file.xlsx")
workbook.sheet_names
# ["Sheet1", "Sheet2"]
workbook.get_sheet_by_name("Sheet1").to_python()
# [
# ["1", "2", "3", "4", "5", "6", "7"],
# ["1", "2", "3", "4", "5", "6", "7"],
# ["1", "2", "3", "4", "5", "6", "7"],
# ]
By default, calamine skips empty rows/cols before data. For suppress this behaviour, set skip_empty_area
to False
.
from python_calamine import CalamineWorkbook
workbook = CalamineWorkbook.from_path("file.xlsx").get_sheet_by_name("Sheet1").to_python(skip_empty_area=False)
# [
# [", ", ", ", ", ", "],
# ["1", "2", "3", "4", "5", "6", "7"],
# ["1", "2", "3", "4", "5", "6", "7"],
# ["1", "2", "3", "4", "5", "6", "7"],
# ]
Also, you can use monkeypatch for pandas for use this library as engine in read_excel()
(only pandas 2.0 and 2.1 are supported).
Pandas 2.2 and above have built-in support of python-calamine.
from pandas import read_excel
from python_calamine.pandas import pandas_monkeypatch
pandas_monkeypatch()
read_excel("file.xlsx", engine="calamine")
# 1 2 3 4 5 6 7
# 0 1 2 3 4 5 6 7
# 1 1 2 3 4 5 6 7
Also, you can find additional examples in tests.
You'll need rust installed.
# clone this repo or your fork
git clone git@github.com:dimastbk/python-calamine.git
cd python-calamine
# create a new virtual env
python3 -m venv env
source env/bin/activate
# install dev dependencies and install python-calamine
pip install -e .[dev]
# lint code
pre-commit run --all-files
# test code
pytest
FAQs
Python binding for Rust's library for reading excel and odf file - calamine
We found that python-calamine demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.