The format of the value is some fraction value + ((1|0)-.*)? Some lines will only have a fraction value. E,g. the 1st line. I want to split this into two columns as follows
4048.187796,
4254.621567233334, 0-0-0-
4229.915599566667, 1-0-0-
4427.049432183334, 0-0-0-
4303.42859305, 0-0-0-
4256.623506416667, 0-0-0-
4132.539952583333, 0-0-0-
4263.582014283334, 1-0-0-
4320.695559183334, 0-0-0-
4342.127011933333, 0-0-0-
4447.828341683334, 0-0-0-
4409.230520250001, 0-0-0-
4280.65057085, 0-1-0-
4283.594289816668, 0-0-0-
4341.189635866667, 0-0-0-
4263.128218700001, 0-0-0-
4222.311909533333, 0-0-0-
4314.984407333333, 1-0-0-
I can do this by reading line by line and then manipulate each value by finding the index of '-' and substring that by index - 2. But as I have several files and each file has more than 1000 lines I don't want to do that. Is there a way for me to do this directly using panda and slice functions?
I tried df['new_col'] = df['last'].str.slice But Ican't give a fix value to slice start index as it changes from row to row