I am using python csvkit
to compare 2 files like this:
df1 = pd.read_csv('input1.csv', sep=',\s+', delimiter=',', encoding="utf-8")
df2 = pd.read_csv('input2.csv', sep=',\s,', delimiter=',', encoding="utf-8")
df3 = pd.merge(df1,df2, on='employee_id', how='right')
df3.to_csv('output.csv', encoding='utf-8', index=False)
Currently I am running the file through a script before hand that strips spaces from the employee_id
column.
An example of employee_id
s:
37 78973 3
23787
2 22 3
123
Is there a way to get csvkit
to do it and save me a step?
str.strip
orNone
? I'm importing data from Excel and it would be great if I could turn empty cells intoNone
without additional steps, but I'm not sure whether this kind of magic is legal. – Shortterm