So I got this task where the user provides a list of extenstions and then I need to plot a histogram of their occurrence, saving it to a png and pdf file. The output plot needs to have a title and its axis need to be identified as well. example : Input: [’aux’, ’log’, ’pdf’, ’py’, ’gz’, ’tex’, ’py’, ’pyc’, ’csv’, ’txt’, ’bin’, ’csv’] and then this is plotted to show a histogram of how many occurrences each extenstion have. Now I wrote this code but whenever I want to give x and y axis a titel or give my whole plot a titel I get error. I don't know what I am doing wrong as I searched everywhere and everyone is doing the same as me. Thanks!
import pandas
from collections import Counter
strings = input("Enter a list of extenstions separated by space")
list = strings.split()
letter_counts = Counter(list)
print(letter_counts)
df = pandas.DataFrame.from_dict(letter_counts, orient='index')
df.plot(kind='bar',x='extension',y='times', titel='Figure 1')