---
# System prepended metadata

title: weather

---

## categorize code

```python!=
import pandas as pd
import numpy as np

# Read the CSV file
df = pd.read_csv('traffic_weather_6.csv')

# Function to categorize values
def categorize(value, low_threshold, high_threshold):
    if value <= low_threshold:
        return 'low'
    elif value <= high_threshold:
        return 'medium'
    else:
        return 'high'

# Define thresholds for each column
# You may need to adjust these based on your specific data
thresholds = {
    'WindSpeed': (3.4, 10.7),
    'Temperature': (10, 36),
    'Humidity': (50, 80)
}

# Apply categorization to each column
for column, (low, high) in thresholds.items():
    df[f'{column}_Category'] = df[column].apply(categorize, args=(low, high))

# Save the updated DataFrame to a new CSV file
df.to_csv('categorized_weather_data.csv', index=False)

print("Categorization complete. Results saved to 'categorized_weather_data.csv'")
```


$$
```
<!DOCTYPE html>
<html lang="zh-TW">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>即時影像</title>
    <style>
        /* 設定影像的尺寸 */
        .cctv-image {
            width: 800px; /* 設定寬度 */
            height: 600px; /* 設定高度 */
            display: block; /* 使影像顯示為區塊元素 */
            margin-bottom: 20px; /* 影像之間的間距 */
        }
    </style>
</head>
<body>
    <h1>監視器即時影像</h1>
    
    <h2>土城交流道 ~ 中和交流道</h2>
    <img id="cctvImage2" class="cctv-image" src="https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=33680&0.28100645979786965&t1968=0.8209164648645608" />


    <h2>泰山轉接道 ~ 林口交流道</h2>
    <img id="cctvImage1" class="cctv-image" src="https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=13650&0.337705775011478&t1968=0.34601889479715275" />

    <h2>五股轉接道 ~ 五股交流道</h2>
    <img id="cctvImage3" class="cctv-image" src="https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=13240&0.2263200630159692&t1968=0.4315598647091414" />
    
    <script>
        // 每5秒刷新第一個影像
        setInterval(function() {
            var img1 = document.getElementById('cctvImage1');
            var timestamp = new Date().getTime();
            img1.src = "https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=13650&t=" + timestamp;
        }, 5000);

        // 每5秒刷新第二個影像
        setInterval(function() {
            var img2 = document.getElementById('cctvImage2');
            var timestamp = new Date().getTime();
            img2.src = "https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=33680&t=" + timestamp;
        }, 5000);

        // 未來添加第三個影像的刷新函數
        setInterval(function() {
            var img3 = document.getElementById('cctvImage3');
            var timestamp = new Date().getTime();
            img3.src = "https://cctvn.freeway.gov.tw/abs2mjpg/bmjpg?camera=13240&t=" + timestamp;
        }, 5000);
    </script>
</body>
</html>
```