From 0b49f0ce5f779afcece555ea5b93c035dda72661 Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 13 Oct 2026 15:34:51 +0800 Subject: [PATCH] Write the wiki in English, Danish and Bahasa Melayu Task: MIL-005#3 --- wiki/.publish | 0 wiki/Home.da.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ wiki/Home.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++ wiki/Home.ms.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ wiki/_Sidebar.md | 13 +++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 wiki/.publish create mode 100644 wiki/Home.da.md create mode 100644 wiki/Home.md create mode 100644 wiki/Home.ms.md create mode 100644 wiki/_Sidebar.md diff --git a/wiki/.publish b/wiki/.publish new file mode 100644 index 0000000..e69de29 diff --git a/wiki/Home.da.md b/wiki/Home.da.md new file mode 100644 index 0000000..fa8e1c8 --- /dev/null +++ b/wiki/Home.da.md @@ -0,0 +1,49 @@ +> Denne side er genereret fra README.md og wiki/. Ændringer her bliver overskrevet, næste gang wikien udgives. + +> Den engelske side er den gældende; denne oversættelse følger den. + +[English](Home) | Dansk | [Bahasa Melayu](Home.ms) + +# Vejrdata (dag 25) + +At læse CSV-vejrdata i Python. Det er opgaven fra dag 25 i Udemys *100 Days of Code: The Complete Python Pro Bootcamp*. Lektionerne læser en uges vejr fra `weather_data.csv` med Pythons indbyggede `csv`-bibliotek og samler temperaturerne som hele tal, og viser derefter, hvordan biblioteket `pandas` gør det samme på én linje. En tabel er en `DataFrame`, og en kolonne i den er en `Series`; begge kan omdannes til en ordbog og en liste, gennemsnits- og maksimumtemperaturen kan beregnes, rækker kan udvælges ud fra en betingelse, og en `DataFrame` kan oprettes ud fra en ordbog og eksporteres til en CSV-fil. + +![Programmet kører i en terminal: rækkerne og temperaturerne læst med csv-biblioteket, derefter datarammen, ordbogen, listen, gennemsnittet 17,43, maksimum 24, mandagens række, den varmeste række søndag, mandag i Fahrenheit 53,6 og tabellen med point](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather/raw/branch/main/docs/images/weather-run.png) + +*`python -m weather` i en terminal: først csv-delen, derefter pandas-delen.* + +## Hvad programmet skriver + +| Del | Resultat | +| --- | --- | +| `csv`-biblioteket | Filens rækker og temperaturerne `[12, 14, 15, 14, 21, 22, 24]` | +| `pandas` | `DataFrame`, ordbogen og listen med temperaturer | +| Statistik | Gennemsnit 17,43 (i hånden og med `mean`) og maksimum 24 | +| Rækkeudvælgelse | Mandagens række, den varmeste dags række (søndag), mandag i Fahrenheit (53,6) | +| Opret og eksportér | En `DataFrame` med elever og point lavet ud fra en ordbog; skrives kun til en fil med `--export` | + +## Funktioner + +| Funktion | Modul | Lektion | +| --- | --- | --- | +| `read_rows`, `read_temperatures` | `weather.csv_reader` | Læsning med `csv`-biblioteket | +| `read_data` | `weather.analysis` | `pandas.read_csv` | +| `to_data_dict`, `to_temp_list` | `weather.analysis` | `to_dict`, `to_list` | +| `average_temp`, `average_temp_mean`, `max_temp` | `weather.analysis` | Sum og længde, `mean`, `max` | +| `row_for_day`, `hottest_row`, `day_in_fahrenheit` | `weather.analysis` | Udvælgelse af rækker | +| `create_scores_frame`, `export_frame` | `weather.export` | `DataFrame` ud fra en ordbog, `to_csv` | + +## Kør programmet + +Der skal bruges Python 3.13 eller nyere. `csv`-delen har ingen afhængigheder ved kørsel; `pandas` er et valgfrit tilvalg, som `dev`-tilvalget installerer. + +```bash +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather.git +cd 025-weather +python -m venv .venv +python -m pip install --upgrade pip +python -m pip install -e ".[dev]" +python -m weather +``` + +Tilføj `--export new_data.csv` for også at skrive tabellen med point til en fil. Repositoriets README har den fulde opsætning til Windows, Linux og macOS. diff --git a/wiki/Home.md b/wiki/Home.md new file mode 100644 index 0000000..afe420f --- /dev/null +++ b/wiki/Home.md @@ -0,0 +1,47 @@ +> This page is generated from README.md and wiki/. Changes made here are overwritten the next time the wiki is published. + +English | [Dansk](Home.da) | [Bahasa Melayu](Home.ms) + +# Weather Data (Day 25) + +Reading CSV weather data in Python. It is the day-25 assignment of Udemy's *100 Days of Code: The Complete Python Pro Bootcamp*. The lectures read the weather of one week from `weather_data.csv` with Python's built-in `csv` library and collect the temperatures as whole numbers, and then show how the `pandas` library does the same in one line. A table is a `DataFrame` and a column of it is a `Series`; both can be converted to a dictionary and a list, the average and the maximum temperature can be computed, rows can be selected by a condition, and a `DataFrame` can be created from a dictionary and exported to a CSV file. + +![The program running in a terminal: the rows and temperatures read with the csv library, then the data frame, the dictionary, the list, the average 17.43, the maximum 24, the row of Monday, the hottest row Sunday, Monday in Fahrenheit 53.6 and the scores frame](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather/raw/branch/main/docs/images/weather-run.png) + +*`python -m weather` in a terminal: the csv part first, then the pandas part.* + +## What the program prints + +| Part | Result | +| --- | --- | +| `csv` library | The rows of the file and the temperatures `[12, 14, 15, 14, 21, 22, 24]` | +| `pandas` | The `DataFrame`, the dictionary and the list of temperatures | +| Statistics | Average 17.43 (by hand and with `mean`) and maximum 24 | +| Row selection | The row of Monday, the row of the hottest day (Sunday), Monday in Fahrenheit (53.6) | +| Create and export | A `DataFrame` of students and scores made from a dictionary; written to a file only with `--export` | + +## Functions + +| Function | Module | Lecture | +| --- | --- | --- | +| `read_rows`, `read_temperatures` | `weather.csv_reader` | Reading with the `csv` library | +| `read_data` | `weather.analysis` | `pandas.read_csv` | +| `to_data_dict`, `to_temp_list` | `weather.analysis` | `to_dict`, `to_list` | +| `average_temp`, `average_temp_mean`, `max_temp` | `weather.analysis` | Sum and length, `mean`, `max` | +| `row_for_day`, `hottest_row`, `day_in_fahrenheit` | `weather.analysis` | Selecting rows | +| `create_scores_frame`, `export_frame` | `weather.export` | `DataFrame` from a dictionary, `to_csv` | + +## Run + +Python 3.13 or newer is needed. The `csv` part has no runtime dependencies; `pandas` is an optional extra that the `dev` extra installs. + +```bash +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather.git +cd 025-weather +python -m venv .venv +python -m pip install --upgrade pip +python -m pip install -e ".[dev]" +python -m weather +``` + +Add `--export new_data.csv` to also write the scores table to a file. The README of the repository has the full set-up for Windows, Linux and macOS. diff --git a/wiki/Home.ms.md b/wiki/Home.ms.md new file mode 100644 index 0000000..a092b4e --- /dev/null +++ b/wiki/Home.ms.md @@ -0,0 +1,49 @@ +> Halaman ini dijana daripada README.md dan wiki/. Perubahan di sini akan ditimpa apabila wiki diterbitkan lagi. + +> Halaman Bahasa Inggeris adalah yang rasmi; terjemahan ini mengikutinya. + +[English](Home) | [Dansk](Home.da) | Bahasa Melayu + +# Data Cuaca (hari 25) + +Membaca data cuaca CSV dalam Python. Ia ialah tugasan hari ke-25 dalam *100 Days of Code: The Complete Python Pro Bootcamp* di Udemy. Pelajaran membaca cuaca satu minggu daripada `weather_data.csv` dengan pustaka `csv` terbina dalam Python dan mengumpul suhu sebagai nombor bulat, kemudian menunjukkan bagaimana pustaka `pandas` melakukan perkara yang sama dalam satu baris. Satu jadual ialah `DataFrame` dan satu lajur daripadanya ialah `Series`; kedua-duanya boleh ditukar kepada kamus dan senarai, suhu purata dan suhu maksimum boleh dikira, baris boleh dipilih mengikut syarat, dan `DataFrame` boleh dicipta daripada kamus serta dieksport ke fail CSV. + +![Program berjalan dalam terminal: baris dan suhu yang dibaca dengan pustaka csv, kemudian data frame, kamus, senarai, purata 17.43, maksimum 24, baris hari Isnin, baris terpanas hari Ahad, Isnin dalam Fahrenheit 53.6 dan jadual skor](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather/raw/branch/main/docs/images/weather-run.png) + +*`python -m weather` dalam terminal: bahagian csv dahulu, kemudian bahagian pandas.* + +## Apa yang dipaparkan oleh program + +| Bahagian | Hasil | +| --- | --- | +| Pustaka `csv` | Baris fail dan suhu `[12, 14, 15, 14, 21, 22, 24]` | +| `pandas` | `DataFrame`, kamus dan senarai suhu | +| Statistik | Purata 17.43 (secara manual dan dengan `mean`) dan maksimum 24 | +| Pemilihan baris | Baris hari Isnin, baris hari terpanas (Ahad), Isnin dalam Fahrenheit (53.6) | +| Cipta dan eksport | `DataFrame` pelajar dan skor yang dibuat daripada kamus; ditulis ke fail hanya dengan `--export` | + +## Fungsi + +| Fungsi | Modul | Pelajaran | +| --- | --- | --- | +| `read_rows`, `read_temperatures` | `weather.csv_reader` | Membaca dengan pustaka `csv` | +| `read_data` | `weather.analysis` | `pandas.read_csv` | +| `to_data_dict`, `to_temp_list` | `weather.analysis` | `to_dict`, `to_list` | +| `average_temp`, `average_temp_mean`, `max_temp` | `weather.analysis` | Jumlah dan panjang, `mean`, `max` | +| `row_for_day`, `hottest_row`, `day_in_fahrenheit` | `weather.analysis` | Memilih baris | +| `create_scores_frame`, `export_frame` | `weather.export` | `DataFrame` daripada kamus, `to_csv` | + +## Jalankan + +Python 3.13 atau lebih baharu diperlukan. Bahagian `csv` tiada kebergantungan semasa dijalankan; `pandas` ialah tambahan pilihan yang dipasang oleh tambahan `dev`. + +```bash +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/025-weather.git +cd 025-weather +python -m venv .venv +python -m pip install --upgrade pip +python -m pip install -e ".[dev]" +python -m weather +``` + +Tambah `--export new_data.csv` untuk turut menulis jadual skor ke fail. README repositori mempunyai persediaan penuh untuk Windows, Linux dan macOS. diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md new file mode 100644 index 0000000..bda448c --- /dev/null +++ b/wiki/_Sidebar.md @@ -0,0 +1,13 @@ +**Weather Data (Day 25)** + +English + +- [Home](Home) + +Dansk + +- [Hjem](Home.da) + +Bahasa Melayu + +- [Utama](Home.ms)