I have a dataframe with one column containing the following strings:
df=pd.DataFrame(['Hello world', 'World is good', 'Worldisnice hello'], columns=['A'])
df
A
0 'Hello world'
1 'World is good'
2 'Worldisnice hello'
I'm trying to get the rows that contain one word with 11 characters of length
I'm using the following code by it is giving me the length of the string and not the word inside the column
df = df[df['A'].apply(lambda x: len(x) == 11)]
Getting the following result:
df
A
0 'Hello world'
And the output should be:
df
A
0 'Worldisnice hello'
Since is the only one that contains one word with length equals to 11 characters
Thank you