i know how select rows value in particular column. example:
df.loc[df['column_name'] == some_value]
how modify column value 2 capital letters. e.g. ab or fz.
you can use .str.match() method:
in [55]: df out[55]: col 0 xy 1 abc 2 zs 3 aaaaa 4 xc in [56]: df.col.str.match(r'^[a-z]{2}$') out[56]: 0 false 1 false 2 true 3 false 4 true name: col, dtype: bool in [57]: df[df.col.str.match(r'^[a-z]{2}$')] out[57]: col 2 zs 4 xc
Comments
Post a Comment