{"id":8407,"date":"2024-06-02T15:11:54","date_gmt":"2024-06-02T10:11:54","guid":{"rendered":"https:\/\/rfaqs.com\/?page_id=8407"},"modified":"2026-01-08T11:54:54","modified_gmt":"2026-01-08T06:54:54","slug":"charts-and-graphs-in-python","status":"publish","type":"page","link":"https:\/\/rfaqs.com\/charts-and-graphs-in-python\/","title":{"rendered":"Charts and Graphs in Python"},"content":{"rendered":"\n<p>There are various charts and Graphs in Python for data visualization. Seaborn and Matplotlib are two popular Python libraries for graphing in Python. Before plotting in Python, one needs to import the libraries. Since we have to use the data frame for this article and we are also interested in plotting some useful graphs, we will import the following libraries:<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#libraries-required-for-charts-and-graphs-in-python\">Libraries Required for Charts and Graphs in Python<\/a><\/li><li><a href=\"#drawing-boxplot-in-python\">Drawing Boxplot in Python<\/a><\/li><li><a href=\"#draw-histogram-in-python\">Draw Histogram in Python<\/a><\/li><li><a href=\"#draw-pie-charts-in-python\">Draw Pie Charts in Python<\/a><\/li><li><a href=\"#clustered-stacked-bar-graph-in-python\">Clustered\/ Stacked Bar Graph in Python<\/a><\/li><li><a href=\"#mean-plot-or-barplot-in-python\">Mean Plot or Barplot in Python<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"libraries-required-for-charts-and-graphs-in-python\">Libraries Required for Charts and Graphs in Python<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">import numpy as np\nimport pandas as pd\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom scipy import stats<\/pre><\/div>\n\n\n\n<p>In this article, we will use the iris data to visualize different features. For this purpose, let us import the library and the iris data set as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">from vega_datasets import data\niris = data.iris()\niris.head()<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/iris-data-set-information.jpg\"><img decoding=\"async\" width=\"417\" height=\"177\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/iris-data-set-information.jpg\" alt=\"iris data set\" class=\"wp-image-8408\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/iris-data-set-information.jpg 417w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/iris-data-set-information-300x127.jpg 300w\" sizes=\"(max-width: 417px) 100vw, 417px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"drawing-boxplot-in-python\">Drawing Boxplot in Python<\/h3>\n\n\n\n<p>One can draw a boxplot in Python using the boxplot() function from the seaborn library.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">sns.boxplot( y = iris['sepalLength'], data=iris)<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Charts-and-Graphs-in-Python-Box-Plot.jpg\"><img decoding=\"async\" width=\"551\" height=\"390\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Charts-and-Graphs-in-Python-Box-Plot.jpg\" alt=\"Charts and Graphs in Python Box plot\" class=\"wp-image-8409\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Charts-and-Graphs-in-Python-Box-Plot.jpg 551w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Charts-and-Graphs-in-Python-Box-Plot-300x212.jpg 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>The above boxplot is for all observations in the &#8220;sepalLength&#8221; variable. Suppose you are interested in visualizing the sepalLength for each iris species. For this purpose, you need to use the hue argument. For example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">sns.boxplot(x = iris['species'], y = iris['sepalLength'], data=iris, hue=iris['species'])<\/pre><\/div>\n\n\n\n<p>The above code will produce the following graph.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Boxplot-for-each-species.jpg\"><img decoding=\"async\" width=\"560\" height=\"423\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Boxplot-for-each-species.jpg\" alt=\"Charts and graphs in Python Box plot for each species\" class=\"wp-image-8410\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Boxplot-for-each-species.jpg 560w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Boxplot-for-each-species-300x227.jpg 300w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"draw-histogram-in-python\">Draw Histogram in Python<\/h3>\n\n\n\n<p>One can draw a histogram in Python using the hist() function.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">iris['sepalLength'].hist()<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histogram-in-Python.jpg\"><img decoding=\"async\" width=\"537\" height=\"409\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histogram-in-Python.jpg\" alt=\"Charts and Graphs in Python, Histogram\" class=\"wp-image-8411\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histogram-in-Python.jpg 537w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histogram-in-Python-300x228.jpg 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>The following example draws histograms on a single plot. Three variables from a normal distribution are generated and plotted in different colours.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">x1 = np.random.randn(10000) * 0.5\nx2 = np.random.randn(10000) * 1.5 + 3\nx3 = np.random.randn(10000) \n\nplt.hist([x1, x2, x3], bins = 150,\n         label = ['Mean=0, SD=0.5', 'Mean=3, SD=1.5', 'SDN'],\n         color = [&quot;b&quot;, &quot;green&quot;, &quot;magenta&quot;]\n                  )\nplt.xlabel('Value')\nplt.ylabel('Frequency')\nplt.legend()\nplt.show()<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histograms-in-Python.jpg\"><img decoding=\"async\" width=\"563\" height=\"419\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histograms-in-Python.jpg\" alt=\"Histograms in Python\" class=\"wp-image-8412\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histograms-in-Python.jpg 563w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/histograms-in-Python-300x223.jpg 300w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"draw-pie-charts-in-python\">Draw Pie Charts in Python<\/h3>\n\n\n\n<p>One can easily draw Pie charts in Python by using the pie() function. The following is simple and self-explanatory code to draw a Pie chart in Python. The Python code below draws the relative sales from four different regions, namely, region A, B, C, and D.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;r&quot;,&quot;mime&quot;:&quot;text\/x-rsrc&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;R&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;r&quot;}\">groups = ['A', 'B', 'C', 'D']\nsales = [50, 63, 29, 45]\nplt.pie(sales, labels = groups, autopct='%.1f%%')\nplt.show()<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Pie-chart-in-Python.jpg\"><img decoding=\"async\" width=\"317\" height=\"315\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Pie-chart-in-Python.jpg\" alt=\"Charts and Graphs in Python: Pie chart\" class=\"wp-image-8413\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Pie-chart-in-Python.jpg 317w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Pie-chart-in-Python-300x298.jpg 300w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Pie-chart-in-Python-150x150.jpg 150w\" sizes=\"(max-width: 317px) 100vw, 317px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"clustered-stacked-bar-graph-in-python\">Clustered\/ Stacked Bar Graph in Python<\/h3>\n\n\n\n<p>One can easily draw bar graphs, clustered, and stacked bar plots in Python. Since there are three varieties of iris flowers, and there are four features (variables) &#8220;sepalLength&#8221;, &#8220;petalLength&#8221;, &#8220;sepalWidth&#8221;, and &#8220;petalWidth&#8221;. We can plot the clustered or stacked bar plot in Python.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;r&quot;,&quot;mime&quot;:&quot;text\/x-rsrc&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;R&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;r&quot;}\">Groups = ['setosa', 'versicolor', 'virginica']\nx = np.arange(3)\n\nplt.bar(x-.2, iris['sepalLength'].groupby(iris.species).mean(), width=.2)\nplt.bar(x+.2, iris['petalLength'].groupby(iris.species).mean(), width=.2)\nplt.bar(x+0, iris['sepalWidth'].groupby(iris.species).mean(), width=.2)\nplt.bar(x+.4, iris['petalWidth'].groupby(iris.species).mean(), width=.2)\n\nplt.xticks (x, Groups)\nplt.xlabel('Species')\nplt.ylabel('Average Sepal Length')\nplt.legend(['Sepal Length', 'Petal Length', 'Sepal Width', 'Petal Width'])\nplt.show()<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Clustered-Bar-plot-in-Python.jpg\"><img decoding=\"async\" width=\"553\" height=\"420\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Clustered-Bar-plot-in-Python.jpg\" alt=\"Charts and Graphs in Python: Clustered Bar Plot\" class=\"wp-image-8414\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Clustered-Bar-plot-in-Python.jpg 553w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/Clustered-Bar-plot-in-Python-300x228.jpg 300w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Since a small quantity is added or subtracted in the x-axis, we get the clustered bar graph. We addition or subtraction of values in the x-axis is removed, we will get a stacked bar plot. The updated code for the stacked bar plot is given below:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">Groups = ['setosa', 'versicolor', 'virginica']\nx = np.arange(3)\n\nplt.bar(x, iris['sepalLength'].groupby(iris.species).mean(), width=.4)\nplt.bar(x, iris['petalLength'].groupby(iris.species).mean(), width=.4)\nplt.bar(x, iris['sepalWidth'].groupby(iris.species).mean(), width=.4)\nplt.bar(x, iris['petalWidth'].groupby(iris.species).mean(), width=.4)\n\nplt.xticks (x, Groups)\nplt.xlabel('Species')\nplt.ylabel('Average Sepal Length')\nplt.legend(['Sepal Length', 'Petal Length', 'Sepal Width', 'Petal Width'])\nplt.show()\n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/stacked-bar-plot-in-python.jpg\"><img decoding=\"async\" width=\"544\" height=\"420\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/stacked-bar-plot-in-python.jpg\" alt=\"Charts and Graphs in Python: Stacked Bar Plot\" class=\"wp-image-8415\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/stacked-bar-plot-in-python.jpg 544w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/stacked-bar-plot-in-python-300x232.jpg 300w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"mean-plot-or-barplot-in-python\">Mean Plot or Barplot in Python<\/h3>\n\n\n\n<p>The barplot() function from the seaborn library can be used to draw the mean bar plots. For example,<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">sns.barplot(data=iris, x=&quot;species&quot;, y=&quot;sepalLength&quot;)\n\nplt.show() <\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/barplots-in-Python.jpg\"><img decoding=\"async\" width=\"547\" height=\"425\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/barplots-in-Python.jpg\" alt=\"Barplot in Python\" class=\"wp-image-8416\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/barplots-in-Python.jpg 547w, https:\/\/rfaqs.com\/wp-content\/uploads\/2024\/06\/barplots-in-Python-300x233.jpg 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Note that one can compute the average values for each variety regarding their &#8220;sepalLength&#8221; by using gropuby() function. For example,<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">iris['sepalLength'].groupby(iris.species).mean()\n\n## Output\nspecies\nsetosa        5.006\nversicolor    5.936\nvirginica     6.588\nName: sepalLength, dtype: float64<\/pre><\/div>\n\n\n\n<p class=\"has-text-align-center\"><a href=\"https:\/\/itfeature.com\/chart-and-graphics\/describing-data-statistics\/\" target=\"_blank\" rel=\"noreferrer noopener\">Describing Data<\/a><\/p>\n\n\n\n<p class=\"has-text-align-center\"><a href=\"https:\/\/gmstat.com\/computer\/c-language\/\" target=\"_blank\" rel=\"noreferrer noopener\">MCQS C++ Language<\/a> <\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.youtube.com\/watch?v=1SZPHEo2F-k\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>There are various charts and Graphs in Python for data visualization. Seaborn and Matplotlib are two popular Python libraries for graphing in Python. Before plotting in Python, one needs to import the libraries. Since we have to use the data &#8230; <a title=\"Charts and Graphs in Python\" class=\"read-more\" href=\"https:\/\/rfaqs.com\/charts-and-graphs-in-python\/\" aria-label=\"Read more about Charts and Graphs in Python\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-8407","page","type-page","status-publish"],"_links":{"self":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/pages\/8407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/comments?post=8407"}],"version-history":[{"count":0,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/pages\/8407\/revisions"}],"wp:attachment":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/media?parent=8407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}