I have the dataframe with columns of strings. I want to use a part of it in some function. A part to be used is defined by condition which passed into function.
def myfunc(condition):
tmp_df = df[condition].copy()
#doing something else wit tmp_df
return some_result
My questions are:
How can I pass condition for string columns? For example:
df.str_column.str.len()>10
How to pass an empty condition, when I need to use all dataframe?
I found solutions for numeric columns, but how to work with strings?
df.str_column.str.len() > 10- can you not just pass a dataframe that's already subsetted tomyfunc... so you call it asmyfunc(df[df.str_column.str.len() > 10])?