Can you explain how you handle missing values, duplicates, and data reshaping using Python libraries like Pandas and NumPy?
Translate this data-cleaning task into PostgreSQL using raw_metric_readings and metric_catalog. Keep missing metric values as NULL, retain only the latest duplicate reading, and produce the requested wide result.
device_id, reading_time, temperature_c, humidity_pct, and power_wdevice_id and reading_time ascending| Column | Type | Description |
|---|---|---|
| reading_idPK | INT | Unique identifier for the raw reading |
| device_id | VARCHAR(20) | Identifier of the AMD device |
| reading_time | TIMESTAMP | Timestamp represented by the reading |
| metric_name | VARCHAR(40) | Name of the recorded metric |
| metric_value | DECIMAL(10,2) | Numeric metric value, which may be missing |
| ingested_at | TIMESTAMP | Time the row was ingested |
| Column | Type | Description |
|---|---|---|
| metric_namePK | VARCHAR(40) | Recognized metric name |
| display_name | VARCHAR(80) | Human-readable metric label |