I would like to ask for help with the following problem:
I need to use a downloaded txt data with this duplicate id at the end of the row structure.
UID value1 value2
A01 99 10 A01
A02 29 12 A02
A03 96 14 A03
My desired output would look like
UID value1 value2
A01 99 10
A02 29 12
A03 96 14
How can I use pandas to read this structure and drop the last duplicate column.
fun fact: Without special reading parameters, the UID column becomes index and every column shifts.
I have ideas to do workarounds, but I want to handle the problem in python and looking for a clean solution for this problem.
Thank you in advance!
For me working use index_col=False
, then last column without header is removed:
df = pd.read_csv(file, index_col=False)
print (df)
UID value1 value2
0 A01 99 10
1 A02 29 12
2 A03 96 14