From 4aedc246a3132652e78d056fa67466a1bf8ec5a2 Mon Sep 17 00:00:00 2001 From: Laborratte5 Date: Sun, 1 Jun 2025 13:31:43 +0200 Subject: [PATCH] Use pandas to read xlsx file --- poetry.lock | 46 ++++++++++++++++++++++--------------- pyproject.toml | 4 ++-- src/cluster_test/cluster.py | 8 +++++++ 3 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 src/cluster_test/cluster.py diff --git a/poetry.lock b/poetry.lock index 00efdb4..c8f436c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,17 @@ # This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. +[[package]] +name = "et-xmlfile" +version = "2.0.0" +description = "An implementation of lxml.xmlfile for the standard library" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "et_xmlfile-2.0.0-py3-none-any.whl", hash = "sha256:7a91720bc756843502c3b7504c77b8fe44217c85c537d85037f0f536151b2caa"}, + {file = "et_xmlfile-2.0.0.tar.gz", hash = "sha256:dab3f4764309081ce75662649be815c4c9081e88f0837825f90fd28317d4da54"}, +] + [[package]] name = "numpy" version = "2.0.2" @@ -122,6 +134,21 @@ files = [ {file = "numpy-2.2.6.tar.gz", hash = "sha256:e29554e2bef54a90aa5cc07da6ce955accb83f21ab5de01a62c8478897b264fd"}, ] +[[package]] +name = "openpyxl" +version = "3.1.5" +description = "A Python library to read/write Excel 2010 xlsx/xlsm files" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "openpyxl-3.1.5-py2.py3-none-any.whl", hash = "sha256:5282c12b107bffeef825f4617dc029afaf41d0ea60823bbb665ef3079dc79de2"}, + {file = "openpyxl-3.1.5.tar.gz", hash = "sha256:cf0e3cf56142039133628b5acffe8ef0c12bc902d2aadd3e0fe5878dc08d1050"}, +] + +[package.dependencies] +et-xmlfile = "*" + [[package]] name = "pandas" version = "2.2.3" @@ -260,24 +287,7 @@ files = [ {file = "tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9"}, ] -[[package]] -name = "xlrd" -version = "2.0.1" -description = "Library for developers to extract data from Microsoft Excel (tm) .xls spreadsheet files" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" -groups = ["main"] -files = [ - {file = "xlrd-2.0.1-py2.py3-none-any.whl", hash = "sha256:6a33ee89877bd9abc1158129f6e94be74e2679636b8a205b43b85206c3f0bbdd"}, - {file = "xlrd-2.0.1.tar.gz", hash = "sha256:f72f148f54442c6b056bf931dbc34f986fd0c3b0b6b5a58d013c9aef274d0c88"}, -] - -[package.extras] -build = ["twine", "wheel"] -docs = ["sphinx"] -test = ["pytest", "pytest-cov"] - [metadata] lock-version = "2.1" python-versions = ">=3.9" -content-hash = "fd9c2dfe4dc68ecc8da88c157f0168ae23ff7959261b103857445050d412543c" +content-hash = "dadddaadad9da05a69b37a46a98cfe500ed81dd33eb1300e70545a63aa154987" diff --git a/pyproject.toml b/pyproject.toml index babc511..b8d9ee0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,8 +9,8 @@ license = {text = "MIT"} readme = "README.md" requires-python = ">=3.9" dependencies = [ - "xlrd (>=2.0.1,<3.0.0)", - "pandas (>=2.2.3,<3.0.0)" + "pandas (>=2.2.3,<3.0.0)", + "openpyxl (>=3.1.5,<4.0.0)" ] [tool.poetry] diff --git a/src/cluster_test/cluster.py b/src/cluster_test/cluster.py new file mode 100644 index 0000000..055f141 --- /dev/null +++ b/src/cluster_test/cluster.py @@ -0,0 +1,8 @@ +import pandas + +def read_excel(path: str): + data = pandas.read_excel(path) + print(data) + +if __name__ == '__main__': + read_excel("tests/Beispiel Auswertung.xlsx") \ No newline at end of file