LP13
LP13

Reputation: 1

How do I use bins as my xticks in Matplotlib?

I am watching Keith Galli's Tutorial on Matplotlib

This code is used to create a histogram. It gives me a Type Error on line 9

     import matplotlib.pyplot as plt
     import pandas as pd
     fifa = pd.read_csv(r"C:\Users\luchc\Downloads\fifa_data.csv.txt")

     bins = [0,10,20,30,40,50,60,70,80,90,100]

     plt.hist(fifa['Overall'], bins=bins)

     plt.xticks(bins)

     plt.xlabel('Overall')
     plt.ylabel('# of Players')
     plt.title('Distribution of Overall of Players in FIFA18')

     plt.show()

     

Upvotes: 0

Views: 47

Answers (1)

Moaz Ragab
Moaz Ragab

Reputation: 186

replace

 fifa = pd.read_csv(r"C:\Users\luchc\Downloads\fifa_data.csv.txt")

to

 fifa = pd.read_csv(r"C:\Users\luchc\Downloads\fifa_data.csv")

Upvotes: 2

Related Questions