Function to count words in Python I am new to developing in Python and would like to see comments about my word count solution.

Please indicate my mistakes or best solutions.

def count_words(text):
  text = text.lower()

  symbols = "1234567890!#$%^&amp;*\"()_+=-{}[].,:"
  for s in list(symbols):
    text = text.replace(s,"")
  text = text.split()
  lst = list(set(text))
  dictonary = {"words":lst, "nums":[0]*len(lst)}
  for word in text:
    dictonary['nums'][dictonary['words'].index(word)] += 1

  import pandas as pd  
  df = pd.DataFrame(dictonary)
  return df.sort_values(by=['nums'], ascending=False)#.to_csv("./words.csv")

count_words("Hello world, World War, War and Peace")
How about using collections.Counter:

import string
from collections import Counter


def count_words(text):
    text = text.lower()
    for s in string.digits + string.punctuation:
        text = text.replace(s, "")
    text = text.split()
    return Counter(text)


print(count_words("Hello world, World War, War and Peace"))