Return part of string every cell of pd.Dataframe

There is a pd.DataFrame
df: | |crit|acc_num| |-|--------------------|---------| |0|050_11_20 0021351-05| 27045980|
|1|051_09_20 0021351-05| 27145990|
|2|058_77_21 0021351-05| 27245910|
|3|075_85_21 0021351-05| 27445920|

All data is str.
How can I return lines 2,3 which has '21' on position [8,9] in column 'crit'?



Read more here: https://stackoverflow.com/questions/67018493/return-part-of-string-every-cell-of-pd-dataframe

Content Attribution

This content was originally published by Vadim.M. at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: