I have a python script in which I want to read a csv file and then import this data into a postgres table. Unfortunately the csv file is quite messy and has many blank lines.
arg = {
'date': date,
'store_id': row[0].strip(),
'price': row[1].strip(),
'description': row[2].strip()
}
cur.execute(
"""INSERT INTO
"Inventory"("date","store_id","price","description")
select %(date)s,
%(store_id)s,
%(price)s,
%(description)s
;""", arg)
I want to skip stripping any row that has an empty cell for store_id and description - how would I do this?