From repairing bad data to decoding awful APIs– these saved me.
I have actually remained in corporate dev teams long enough to recognize one axiom: nobody really cares if your code is lovely– as long as it functions.
Yet when you’re drowning in legacy code, broken APIs, and Excel sheets from 2004, “simply making it work” can eat your peace of mind alive.
Right here are 8 Python tools/scripts that genuinely conserved me in those minutes. These aren’t your normal “Hi Globe” hacks– these are survival devices. I made use of each of them in real-world, disorderly situations.
Let’s enter.
1 The Excel Sanitizer (When Financing Sends You Garbage Sheets)
Financing likes Excel. Designers hate Excel. Especially when half the cells are merged, days are “text,” and the CEO’s pet column is named Earnings (Last) v 3
Below’s the fast repair I contacted unmerge, normalize, and tidy Excel files before I touched them:
import pandas as pd
def sanitize_excel(documents):
df = pd.read _ stand out(file, header=None) # overlook their headers
df = df.dropna(exactly how='all') # remove vacant rows
df = df.fillna (''-RRB- # replace NaNs with spaces
df.columns =...