Here's an example on how to accomplish the task using Pandas library:
main.py457 chars17 lines
The code reads the first csv file with pd.read_csv
, concatenates the first two columns with a dash, and stores the result in a new column named concatenated
. Then, it reads the second csv file and filters it based on a condition that excludes the rows where the first column starts with the concatenated value. Finally, it saves the filtered dataframe into a new csv file using to_csv
function with index=False
to exclude the index column.
gistlibby LogSnag