Feb-14-2019, 01:26 PM
Dear all,
I have a pandas dataframe and I created an extra column containing the string length of a record with
I should count individual words in a string, get their length and divide them by the number of words. In the second case, I should retrieve specific words from a string and count them. And all as a lambda function. This is a bit beyond me.
Do you have any tips?...
Thank you
Luigi
I have a pandas dataframe and I created an extra column containing the string length of a record with
essay_cols=["record0", "record1"...] # where 'recordX' is the name of a column all_essays = all_essays[essay_cols].apply(lambda x: ' '.join(x), axis=1) # I understand this joins all the words of the different columns in a single string all_data["essay_len"] = all_essays.apply(lambda x: len(x)) # does this give the word count of a string or the length of a string?But how can I make a field with the average word length and frequency of certain words?
I should count individual words in a string, get their length and divide them by the number of words. In the second case, I should retrieve specific words from a string and count them. And all as a lambda function. This is a bit beyond me.
Do you have any tips?...
Thank you
Luigi