Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Phaeton committed Feb 8, 2025
1 parent e9f14fc commit 8f3bc61
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
10 changes: 6 additions & 4 deletions scripts/export_categories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""""script to export current categories, this time sorted descending by frequency"""
""" "script to export current categories, sorted descending by frequency"""

import logging
import pandas as pd
Expand All @@ -11,11 +11,13 @@
logging.info("Reading the main csv file...")
df = pd.read_csv("plane-alert-db.csv")

logging.info("Sorting categories by frequency...")
category_sorted = df["Category"].value_counts().index.to_series().reset_index(drop=True)
logging.info("Identifying and sorting categories by frequency...")
category_sorted = (
df["Category"].value_counts().index.to_series().reset_index(drop=True)
)

logging.info(f"Total Unique Categories: ({category_sorted.shape[0]}).")
logging.info("Creating the plane-alert-categories.csv file sorted by frequency.")
logging.info("Creating the plane-alert-categories.csv file, sorted by frequency.")

category_sorted.to_csv(
"plane-alert-categories.csv",
Expand Down
45 changes: 22 additions & 23 deletions scripts/update_readme.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Script that performs several counts to update the README
"""
"""Script that performs several counts to update the README"""

import logging
import pandas as pd
Expand All @@ -20,23 +19,13 @@
images_df = pd.read_csv("plane_images.csv")
logging.info("All csv files read successfully.")

plane_count_df = (
df["$ICAO"]
.drop_duplicates()
.reset_index(drop=True)
)
plane_count_df = df["$ICAO"].drop_duplicates().reset_index(drop=True)
logging.info(f"Total Planes Count: ({plane_count_df.shape[0]}).")

category_unique_df = (
df["Category"]
.drop_duplicates()
.reset_index(drop=True)
)
category_unique_df = df["Category"].drop_duplicates().reset_index(drop=True)
logging.info(f"Total Categories Count: ({category_unique_df.shape[0]}).")

category_df = df["Category"].reset_index(
drop=False
)
category_df = df["Category"].reset_index(drop=False)

logging.info("Generating Counts to update README.md via mustache template.")

Expand Down Expand Up @@ -102,7 +91,9 @@
"flying_doctors_count": category_df[
category_df["Category"] == "Flying Doctors"
].shape[0],
"gaf_count": category_df[category_df["Category"] == "GAF"].shape[0],
"gaf_count": category_df[
category_df["Category"] == "GAF"
].shape[0],
"gas_bags_count": category_df[
category_df["Category"] == "Gas Bags"
].shape[0],
Expand Down Expand Up @@ -142,7 +133,9 @@
"psa_count": category_df[
category_df["Category"] == "Perfectly Serviceable Aircraft"
].shape[0],
"pia_count": category_df[category_df["Category"] == "PIA"].shape[0],
"pia_count": category_df[
category_df["Category"] == "PIA"
].shape[0],
"police_forces_count": category_df[
category_df["Category"] == "Police Forces"
].shape[0],
Expand All @@ -158,7 +151,9 @@
"radiohead_count": category_df[
category_df["Category"] == "Radiohead"
].shape[0],
"raf_count": category_df[category_df["Category"] == "RAF"].shape[0],
"raf_count": category_df[category_df[
"Category"] == "RAF"
].shape[0],
"royal_aircraft_count": category_df[
category_df["Category"] == "Royal Aircraft"
].shape[0],
Expand All @@ -171,20 +166,24 @@
"special_forces_count": category_df[
category_df["Category"] == "Special Forces"
].shape[0],
"uav_count": category_df[category_df["Category"] == "UAV"].shape[0],
"uav_count": category_df[
category_df["Category"] == "UAV"
].shape[0],
"uk_police_count": category_df[
category_df["Category"] == "UK National Police Air Service"
].shape[0],
"ukraine_count": category_df[category_df["Category"] == "Ukraine"].shape[0],
"ukraine_count": category_df[
category_df["Category"] == "Ukraine"
].shape[0],
"us_marines_count": category_df[
category_df["Category"] == "United States Marine Corps"
].shape[0],
"us_navy_count": category_df[
category_df["Category"] == "United States Navy"
].shape[0],
"usaf_count": category_df[category_df["Category"] == "USAF"].shape[
0
],
"usaf_count": category_df[
category_df["Category"] == "USAF"
].shape[0],
"vanity_plate_count": category_df[
category_df["Category"] == "Vanity Plate"
].shape[0],
Expand Down

0 comments on commit 8f3bc61

Please sign in to comment.