We help IT Professionals succeed at work.

Python/Pandas Barchart label

Junior Vasquez
on
High Priority
60 Views
1 Endorsement
Last Modified: 2020-03-09
using the below code, i'm getting the ordinal positions for the barchart produced instead of the column names from the .csv(dataframe) i can't figure out how to get to column names into the chart

import pyodbc
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv('c:/python/incidents_hist.csv')
dfPandaBarChargdf.plot.bar()
Comment
Watch Question

NorieAnalyst Assistant
CERTIFIED EXPERT

Commented:
Junior

Can you upload a small sample CSV file?
Junior VasquezIT Specialist

Author

Commented:


OK here's the sample.


incidents_hist.csv

CERTIFIED EXPERT
Commented:
import pyodbc
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv('incident_hints.csv')
df
df.set_index("Column",drop=True,inplace=True)
df.plot.bar()

Screenshot-2020-03-03-at-17.25.12.png