commit 1c9648b69d1c07f7c8a4d30a275ab039715032a5 Author: Kristofers Solo Date: Mon Dec 18 18:01:51 2023 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5dbd8f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,133 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +local-cdn/ +node_modules/ +package-lock.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5ef2ad6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Kristofers Solo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..96a4a8e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# LU Data analysis and visualization +## Task +Read [here](./TASK.md). diff --git a/TASK.md b/TASK.md new file mode 100644 index 0000000..879e60e --- /dev/null +++ b/TASK.md @@ -0,0 +1,25 @@ +# Data analysis and visualization -- Homework 2 + +## Task 1 (4 points) + +Show the graph ([`matplotlib`](https://pypi.org/project/matplotlib/) bar chart): +1. the average wind speed for each day in August (file [`vejaAtrumsFaktiskais.xlsx`](./data/vejaAtrumsFaktiskais.xlsx)). +2. the maximum gust wind speed for each day in August (file [`vejaAtrumsBrazmas.xlsx`](./data/vejaAtrumsBrazmas.xlsx)). + +The graph must contain all the elements (explanations on the **axes**, **legend**, **caption**) shown in the result example: +![bar chart](./examples/bar-chart.png) + + +## Task 2 (6 points) + +Create a [`matplotlib`](https://pypi.org/project/matplotlib/) box plot that shows the daily average temperature statistics by season. +An example of the final result is shown below. The graph must contain all the elements shown in the example. + +You can use the [`pandas`](https://pypi.org/project/pandas/) or [`numpy`](https://pypi.org/project/numpy/) functionality to aggregate the data. +Note that the statistical values are calculated by the box plot function, but you need to aggregate the average temperatures by day for the individual seasons. + +For this exercise, assume that the winter months are December, January and February, the spring months are March to May, the summer months are June to August and the autumn months are September to November. + +Air temperatures are available in the file [`gaisaTemperatura2022.xlsx`](./data/gaisaTemperatura2022.xlsx) + +![box plot](./examples/box-plot.png) diff --git a/data/gaisaTemperatura2022.xlsx b/data/gaisaTemperatura2022.xlsx new file mode 100644 index 0000000..aa580d2 Binary files /dev/null and b/data/gaisaTemperatura2022.xlsx differ diff --git a/data/vejaAtrumsBrazmas.xlsx b/data/vejaAtrumsBrazmas.xlsx new file mode 100644 index 0000000..4789421 Binary files /dev/null and b/data/vejaAtrumsBrazmas.xlsx differ diff --git a/data/vejaAtrumsFaktiskais.xlsx b/data/vejaAtrumsFaktiskais.xlsx new file mode 100644 index 0000000..bb91eb4 Binary files /dev/null and b/data/vejaAtrumsFaktiskais.xlsx differ diff --git a/examples/bar-chart.png b/examples/bar-chart.png new file mode 100644 index 0000000..6d3975c Binary files /dev/null and b/examples/bar-chart.png differ diff --git a/examples/box-plot.png b/examples/box-plot.png new file mode 100644 index 0000000..e4fbe62 Binary files /dev/null and b/examples/box-plot.png differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c6135bf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[project] +name = "LU-Data-analysis-and-visualization" +version = "0.1.0" +description = "2nd homework for University of Latvia Python course - Data analysis and visualization" +authors = [{ name = "Kristofers Solo", email = "dev@kristofers.xyz" }] +readme = "README.md" +requires-python = ">=3.11" +license = { text = "MIT" } +dependencies = ["attrs==23.1.0", "loguru==0.7.2"] + +[tool.mypy] +check_untyped_defs = true +disallow_any_generics = true +ignore_missing_imports = true +no_implicit_optional = true +no_implicit_reexport = true +show_error_codes = true +strict_equality = true +warn_redundant_casts = true +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +[tool.ruff] +line-length = 160 + +[tool.black] +line-length = 160 + +[tool.ruff.flake8-quotes] +docstring-quotes = "double" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fbae6ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +attrs>=23.1.0 +loguru>=0.7.2 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..67e96b7 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,3 @@ +mypy>=1.6.1 +pytest>=7.4.3 +ruff>=0.1.4