比如dataframe中一列是content,是文本数据。
我怎么生成一列content_times,是统计content这列中每格数据里出现'yes'的次数?
1个回答
count() --- counts how many times str occurs in a string:
>>> SearchMe = "The sky is blue and the ocean is blue too"
>>> print(SearchMe.count("is"))
2
SofaSofa数据科学社区DS面试题库 DS面经