I'm trying to open a txt file with sep=' $
but I get that error.
This is the code:
pd.read_csv("dataset.txt", sep=' $ ', engine='python')
# Error:
error: nothing to repeat at position 0
Sample of the txt file:
u0 $ u2 $ m0 $ ['L276', 'L277']
u0 $ u2 $ m0 $ ['L280', 'L281']
u0 $ u2 $ m0 $ ['L363', 'L364']
u0 $ u2 $ m0 $ ['L365', 'L366']
u0 $ u2 $ m0 $ ['L367', 'L368']
u0 $ u2 $ m0 $ ['L401', 'L402', 'L403']
u0 $ u2 $ m0 $ ['L404', 'L405', 'L406', 'L407']
u0 $ u2 $ m0 $ ['L575', 'L576']
CodePudding user response:
Change the code to:
pd.read_csv('dataset.txt', sep='\ \ \ \$\ \ \ ' , engine='python')
This is because both and $ are considered special characters