首页 > 解决方案 > How to get indices list for rows starting with lower case letter?

问题描述

I have a dataframe with one of the columns being df['Names']. How can I locate all the rows whose names start with a lower case letter?

col1     Names  
1564      abby   
2289      Barry  

etc.

I'm trying to accomplish this using regex with no luck.

标签: pythonregexpandas

解决方案


one way from str.lower

df[df.Names.str[0]==df.Names.str[0].str.lower()]
Out[173]: 
   col1 Names
0  1564  abby

Another way islower

df[df.Names.str[0].str.islower()]
Out[174]: 
   col1 Names
0  1564  abby

推荐阅读