How to use the split function on every row in a dataframe in Python?

pandas 0.20.3 has pandas.Series.str.split() which acts on every string of the series and does the split. So you can simply split and then count the number of splits made

len(reviews['review'].str.split('disappointed')) - 1

pandas.Series.str.split


You can use .str to use string methods on series of strings:

reviews["review"].str.split("disappointed")

You're trying to split the entire review column of the data frame (which is the Series mentioned in the error message). What you want to do is apply a function to each row of the data frame, which you can do by calling apply on the data frame:

f = lambda x: len(x["review"].split("disappointed")) -1
reviews["disappointed"] = reviews.apply(f, axis=1)