Files
AlarmAnalysis/check_sensor_report.py
andy f08a1a9bf5 Initial commit: alarm analysis project
Python project for analyzing alarm data from building monitoring systems.
Includes alarm analyzer, plotting, tests, and source data files.
2026-02-26 09:03:54 -05:00

50 lines
2.1 KiB
Python

#!/usr/bin/env python
# Check the sensor report data structure
import pandas as pd
def check_sensor_report():
print("Loading sensor report...")
# Try to read with header=0 first (new format) then with header=4 (old format)
try:
temp_df = pd.read_excel('SensorReport Cardinal 2025-12-23_processed.xlsx', header=0, nrows=5)
expected_cols = ['ID', 'Remote', 'Group', 'Type', 'Serial No', 'Name']
has_expected_cols = any(col in temp_df.columns for col in expected_cols)
if has_expected_cols:
sensor_df = pd.read_excel('SensorReport Cardinal 2025-12-23_processed.xlsx', header=0)
print("Using new sensor report format (header=0)")
else:
sensor_df = pd.read_excel('SensorReport Cardinal 2025-12-23_processed.xlsx', header=4)
print("Using old sensor report format (header=4)")
except FileNotFoundError:
print("Sensor report file not found. Please ensure 'SensorReport Cardinal 2025-12-23_processed.xlsx' is in the current directory.")
return
print(f"Sensor report shape: {sensor_df.shape}")
print(f"Columns: {list(sensor_df.columns)}")
print("\nFirst few rows:")
print(sensor_df.head(10))
print("\nSample of the specific columns we're interested in:")
sample_ids = [9273, 3817, 8963, 7414, 9092, 9105, 7080, 3799]
for col in ['ID', 'Remote', 'Group', 'Type', 'Serial No']:
print(f"\n{col} column:")
if col in sensor_df.columns:
print(sensor_df[sensor_df['ID'].isin(sample_ids)][col].head(10))
else:
print(f"Column {col} not found")
# Check for some of the IDs that should exist
print(f"\nChecking for specific ID values...")
for sensor_id in sample_ids:
matches = sensor_df[sensor_df['ID'] == float(sensor_id)]
if not matches.empty:
print(f"ID {sensor_id}:")
print(matches[['ID', 'Remote', 'Group', 'Type', 'Name']].iloc[0] if not matches.empty else "No match")
print("---")
if __name__ == "__main__":
check_sensor_report()