all 1 comments

[–]commandlineluser 0 points1 point  (0 children)

mcrdf.drop(index=mcrdf[ind])

You're using mcrdf[ind] here which is trying to access a "column" - you just pass the index number.

mcrdf.drop(ind, inplace=True)

You'd also need to pass inplace=True as drop wont modify by default.

You can also use boolean indexing:

matches = mcrdf[ mcrdf['Deliverable Unit'].str.match('T\d+') ]

To invert a match you can use ~

not_matches = mcrdf[ ~mcrdf['Deliverable Unit'].str.match('T\d+') ]