Untitled

mail@pastecode.io avatar
unknown
plain_text
6 days ago
898 B
2
Indexable
Never
# Clean and extract relevant data from the Balance Sheet
# Remove rows with non-data and reset index for clean processing

# Dropping initial rows that contain titles, and renaming columns based on available data
balance_sheet_cleaned = balance_sheet_df.drop([0, 1, 2, 3]).reset_index(drop=True)

# Renaming columns for easier understanding (taking relevant parts)
balance_sheet_cleaned.columns = [
    "Category", "Description", "2024 Amount", "2023 Amount", "Unnecessary1", "Unnecessary2",
    "Unnecessary3", "Unnecessary4", "Unnecessary5", "Unnecessary6", "Unnecessary7", "Unnecessary8"
]

# Dropping unnecessary columns
balance_sheet_cleaned = balance_sheet_cleaned.drop(
    ["Unnecessary1", "Unnecessary2", "Unnecessary3", "Unnecessary4", "Unnecessary5", "Unnecessary6", "Unnecessary7", "Unnecessary8"],
    axis=1
)

# Displaying the cleaned Balance Sheet data
balance_sheet_cleaned.head()
Leave a Comment