Count number of substrings in dataframe column

You cannot pin a package to a version you don’t have yet. You can maybe use this trick to figure out what’s holding DataFrames from upgrading, see also this thread. Then if you don’t need them, you could remove the packages that are holding you back and proceed to update DataFrames. Gadfly or ExcelReaders are likely candidates of packages that have not yet become compatible with the new DataFrames, but maybe in your case it’s something else.

As per the problem per se, once you update to DataFrames 0.11, you can do either:

count(t -> contains(t, "X"), data[:CITY])

or, if you have missing data you want to skip in the CITY column:

count(t -> contains(t, "X"), skipmissing(data[:CITY]))

1 Like