Skip to content

Instantly share code, notes, and snippets.

@tashrifbillah
Last active February 7, 2023 04:15
Show Gist options
  • Save tashrifbillah/48deae932825d282333211abc8b08f66 to your computer and use it in GitHub Desktop.
Save tashrifbillah/48deae932825d282333211abc8b08f66 to your computer and use it in GitHub Desktop.
Debug form qc excess row problems
#!/usr/bin/env python
# detect files with excess rows
# cd /data/predict1/data_from_nda/formqc/
from glob import glob
import pandas as pd
files=glob('??-*-form_*day1to*csv')
for file in files:
to=int(file.split('-day1to')[-1].strip('.csv'))
df=pd.read_csv(file)
L=len(df)
if L>to:
print(L,file)
# detect max days
files=glob('??-*-form_*day1to*csv')
max_day=1
for file in files:
to=int(file.split('-day1to')[-1].strip('.csv'))
if to>max_day:
print(to,file)
max_day=to
print(max_day)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment