Premium problem153. Hashtag Frequencies

Medium Locked

posts has columns post_id and text.

Pull every hashtag out of text -- a # followed by one or more letters, digits or underscores -- lowercase them, and return a DataFrame with columns hashtag (including the leading #) and count. Sort by count descending then hashtag alphabetically, and renumber the index from 0.

A post can contain several hashtags or none.

Input

   post_id                      text
0        1  love #Pandas and #python
1        2              no tags here
2        3   #PYTHON #pandas #data_1

Output

   hashtag  count
0  #pandas      2
1  #python      2
2  #data_1      1

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)