How to Create a Histogram from Pandas DataFrame? Last Updated : 19 Dec, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report A histogram is a graph that displays the frequency of values in a metric variable's intervals. These intervals are referred to as "bins," and they are all the same width. We can create a histogram from the panda's data frame using the df.hist() function. Syntax: DataFrame.hist(column=None, by=None, grid=True, xlabelsize=None, xrot=None, ylabelsize=None, yrot=None, ax=None, sharex=False, sharey=False, figsize=None, layout=None, bins=10, backend=None, legend=False, **kwargs) Example 1: Creating a basic histogram( histogram for individual columns) We use df.hist() and plot.show() to display the Histogram. CSV file used: gene_expression.csv Python3 # import libraries and packages import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # reading the CSV file df = pd.read_csv('gene_expression.csv') # displaying the DataFrame print(df) # creating a basic histogram df.hist() plt.show() Output: Example 2: Creating a modified histogram(plotting histogram by the group) In this example, we add extra parameters to the hist method. We have changed the fig size, no of bins is specified as 15, and by parameter is given which ensures histograms for each cancer group are created. Python3 # import libraries and packages import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # reading the CSV file df = pd.read_csv('gene_expression.csv') # displaying the DataFrame print(df) # creating a basic histogram df.hist(by='Cancer Present', figsize=[12, 8], bins=15) plt.show() Output: Comment More infoAdvertise with us Next Article How to Create a Histogram from Pandas DataFrame? I isitapol2002 Follow Improve Article Tags : Python Python-pandas Python pandas-plotting Practice Tags : python Similar Reads How to Create Boxplot from Pandas DataFrame? A box plot (or whisker plot) is a statistical graph that shows the minimum, first quartile (Q1), median, third quartile (Q3) and maximum values of a dataset. It helps analyze data spread, skewness and outliers and is widely used in data visualization. In this article you'll learn how to create box p 2 min read How to Create Pie Chart from Pandas DataFrame? A pie chart is a circular statistical graphic divided into slices to illustrate numerical proportions. Each slice represents a category's contribution to the whole, typically expressed as a percentage of 100%. Pie charts are widely used in research, engineering, business analytics and data visualiza 4 min read Pandas DataFrame hist() Method | Create Histogram in Pandas A histogram is a graphical representation of the numerical data. Sometimes you'll want to share data insights with someone, and using graphical representations has become the industry standard. Pandas.DataFrame.hist() function plots the histogram of a given Data frame. It is useful in understanding 4 min read Create empty dataframe in Pandas The Pandas Dataframe is a structure that has data in the 2D format and labels with it. DataFrames are widely used in data science, machine learning, and other such places. DataFrames are the same as SQL tables or Excel sheets but these are faster in use.Empty DataFrame could be created with the help 1 min read How to create a Cumulative Histogram in Plotly? Plotly is a Python library that is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot, and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library 1 min read Like