Skip to content

Instantly share code, notes, and snippets.

@luismarques
Last active February 15, 2024 18:10
Show Gist options
  • Save luismarques/baaa64ff6a37f3047afd64e6bbf645e4 to your computer and use it in GitHub Desktop.
Save luismarques/baaa64ff6a37f3047afd64e6bbf645e4 to your computer and use it in GitHub Desktop.
SiVal report
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import pandas as pd
# Load CSV data into a DataFrame
fn = 'SiVal Items - Update - 2024-02-15.csv'
df = pd.read_csv(fn, keep_default_na=False)
# We want only the remaining tests (ones without a bazel target)
df = df[df['bazel'].isnull() | (df['bazel'] == '') | (df['bazel'] == ' ') | (df['bazel'] == 'None')]
# Group by hw_ip_block and si_stage, then count occurrences
report = df.groupby(['hw_ip_block', 'si_stage']).size().unstack(fill_value=0)
# Rename columns with empty string to 'Blank'
report.rename(columns={' ': 'Blank'}, inplace=True)
# Define the desired column order
desired_order = ['SV1', 'SV2', 'SV3', 'SV4', 'None', 'NA', 'Blank']
# Reorder the columns of the DataFrame
report = report.reindex(columns=desired_order, fill_value=0)
# Avoid printing a line that just says 'hw_ip_block'
report.index.name = 'hw_ip_block'
print(report.to_string(header=True, index=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment