Skip to content

Commit

Permalink
barplot function added
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePabloGFnl committed Aug 22, 2024
1 parent 387ec6a commit 70b0c97
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def plot(self):
return self.histogram()
elif self.plot_option == 2:
return self.boxplot()
elif self.plot_option == 4:
return self.barplot()
else:
return "Invalid plot option"

Expand All @@ -26,4 +28,10 @@ def boxplot(self):
self.data.boxplot(column=self.x)
plt.title("Boxplot of " + self.x)
plt.show()
return self.data[self.x].describe()

def barplot(self):
pd.DataFrame(self.data[self.x].value_counts(normalize=True)).plot.barh()
plt.title("Bar plot of "+x)
plt.show()
return self.data[self.x].describe()

0 comments on commit 70b0c97

Please sign in to comment.