FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Help Required - EDA Python Code Error
Help Required - EDA Python Code Error
Débuté par Mobiwann, 28 juil. 2023 12:17 - Aucune réponse
Connectez-vous…
Mobiwann
#1
Posté le 28 juillet 2023 - 12:17
Hello,
I'm working in Python on an exploratory data analysis (EDA) project and I'm having trouble visualising categorical data. I'd want to make a bar plot similar to this example (here:
https://www.scaler.com/topics/data-science/how-to-become-a-data-scientist/
) to demonstrate the distribution of different automobile manufacturers in my dataset. This is the code I used:
import pandas as pd
import matplotlib.pyplot as plt
# Loading the dataset
data = pd.read_csv('car_data.csv')
# Extracting car brands and their counts
car_brands = data['brand']
brand_counts = car_brands.value_counts()
# Creating the bar plot
plt.bar(car_brands, brand_counts)
plt.xlabel('Car Brands')
plt.ylabel('Count')
plt.title('Distribution of Car Brands')
plt.show()
When I execute the code, however, I receive the following error:
TypeError: '<' not supported between instances of 'str' and 'int'
I'm not sure why I'm seeing this problem or how to resolve it. Could someone kindly explain what's causing this problem and walk me through the proper technique to generate the bar plot for the automobile brands?
Thank you so much for your aid!
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte