

{"id":23104,"date":"2018-07-28T04:00:59","date_gmt":"2018-07-28T04:00:59","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=23104"},"modified":"2026-04-29T12:38:52","modified_gmt":"2026-04-29T07:08:52","slug":"python-time-series","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-time-series\/","title":{"rendered":"Python Time Series Analysis &#8211; Line, Histogram, Density Plotting"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1785,&quot;href&quot;:&quot;https:\\\/\\\/en.wikipedia.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20250416015631\\\/https:\\\/\\\/en.wikipedia.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 00:03:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-13 04:52:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 05:07:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-21 13:23:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-26 12:22:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-31 12:10:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-07 10:52:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-13 14:47:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-17 21:08:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-21 01:31:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-27 02:58:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-30 07:54:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-04 03:22:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-07 14:25:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 11:42:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 04:43:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 19:05:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 10:43:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-02 17:43:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-07 16:38:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 08:19:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 09:10:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 09:14:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 14:56:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-25 14:58:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-28 18:42:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-01 15:37:11&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-07 13:44:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-17 03:18:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-20 15:29:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-25 04:48:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-28 11:51:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-06 07:05:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-15 00:12:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-19 10:24:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-24 04:01:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-27 05:04:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 09:30:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-04 15:01:59&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-04 15:01:59&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p><span style=\"font-weight: 400\">In this <strong><a href=\"https:\/\/data-flair.training\/blogs\/python-tutorial-for-beginners\/\" target=\"_blank\" rel=\"noopener\">Python tutorial<\/a><\/strong>, we will learn about Python Time Series Analysis. Moreover, we will see how to plot the Python Time Series in different forms, like the line graph, Python histogram, density plot, autocorrelation plot, and lag plot. <\/span><\/p>\n<p><span style=\"font-weight: 400\">So, let&#8217;s begin.<\/span><\/p>\n<h3><strong>What is Time Series in Python?<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">Consider a sequence of points of data. Suppose we look at the rate of the dollar ($) to the Indian Rupee. We can link each point of data with a timestamp. Let\u2019s try plotting for this rate over a period of one week. Let\u2019s use <a href=\"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/\" target=\"_blank\" rel=\"noopener\"><strong>Python<\/strong>\u00a0<strong>pandas<\/strong> <\/a>for this.<\/span><\/p>\n<ul>\n<li>The main objective of time series is to study the data from time to time to get some useful predictions and patterns.<\/li>\n<li>It makes decision-making easier and supports forecasting.<\/li>\n<li>To find the latest trends, seasonal patterns and behaviour, data analysis and visualisation are very important.<\/li>\n<\/ul>\n<p><strong>Time series is used in industries such as:<\/strong><\/p>\n<ul>\n<li>Pharmaceuticals<\/li>\n<li>Finance<\/li>\n<li>Social media platforms<\/li>\n<li>Research<\/li>\n<\/ul>\n<h4>a. Data to Use in Python Time Series\u00a0<strong>Analysis<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">We save the following data in a <strong><a href=\"https:\/\/data-flair.training\/blogs\/python-data-file-formats\/\" target=\"_blank\" rel=\"noopener\">CSV file<\/a><\/strong>&#8211;<\/span><br \/>\n<span style=\"font-weight: 400\">Date,<\/span> <span style=\"font-weight: 400\">Rate<\/span><br \/>\n<strong>18-07-2018, 68.625<\/strong><br \/>\n<strong>19-07-2018, 68.9453<\/strong><br \/>\n<strong>20-07-2018, 68.745<\/strong><br \/>\n<strong>21-07-2018, 68.747<\/strong><br \/>\n<strong>22-07-2018, 68.7415<\/strong><br \/>\n<strong>23-07-2018, 68.9449<\/strong><br \/>\n<strong>24-07-2018, 68.9486<\/strong><br \/>\n<span style=\"font-weight: 400\">We save this as dollartorupee.csv.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-numpy-tutorial\/\" target=\"_blank\" rel=\"noopener\">Do you\u00a0know about\u00a0Python\u00a0NumPy?<\/a><\/strong><\/p>\n<h4><strong>b. Plotting a Python Line Chart\/Graph<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Let\u2019s use this data to plot a simple line graph with this.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from pandas import Series\r\n&gt;&gt;&gt; from matplotlib import pyplot\r\n&gt;&gt;&gt; series=Series.from_csv('dollartorupee.csv',header=0)\r\n&gt;&gt;&gt; series.plot()<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x031948D0&gt;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23105\" style=\"width: 599px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/1-3-6.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23105\" class=\"wp-image-23105 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/1-3-6.png\" alt=\"Python Time Series Analysis\" width=\"589\" height=\"447\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/1-3-6.png 589w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/1-3-6-150x114.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/1-3-6-300x228.png 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/a><p id=\"caption-attachment-23105\" class=\"wp-caption-text\">Plotting a Line Graph in Time Series Python Analysis<\/p><\/div>\n<p><span style=\"font-weight: 400\">We can use a line style with this-<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/scipy-tutorial\/\" target=\"_blank\" rel=\"noopener\">Learn more about Python SciPy<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; series.plot(style='k.')<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x033969B0&gt;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23106\" style=\"width: 599px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/2-4-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23106\" class=\"wp-image-23106 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/2-4-1.png\" alt=\"Python Time Series Analysis\" width=\"589\" height=\"439\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/2-4-1.png 589w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/2-4-1-150x112.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/2-4-1-300x224.png 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/a><p id=\"caption-attachment-23106\" class=\"wp-caption-text\">Plotting a Line Graph<\/p><\/div>\n<h3><strong>Plotting a Python Histogram<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">Now, to plot a<a href=\"https:\/\/data-flair.training\/blogs\/python-histogram-python-bar\/\" target=\"_blank\" rel=\"noopener\"> <strong>Python histogram<\/strong><\/a>, we can try the hist() method.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; series.hist()<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x05D683D0&gt;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23107\" style=\"width: 582px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/3-4-3.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23107\" class=\"wp-image-23107 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/3-4-3.png\" alt=\"Python Time Series Analysis\" width=\"572\" height=\"432\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/3-4-3.png 572w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/3-4-3-150x113.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/3-4-3-300x227.png 300w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/><\/a><p id=\"caption-attachment-23107\" class=\"wp-caption-text\">Plotting a Python Histogram in Time Series Python Analysis<\/p><\/div>\n<h3><strong>Density Plot in Python Time Series<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">What if we want to find out the density of the rate values for the entire week?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; series.plot(kind='kde')<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x03194C70&gt;<\/strong><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-interpreter\/\" target=\"_blank\" rel=\"noopener\">Let&#8217;s discuss Python Interpreter<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23108\" style=\"width: 592px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/4-5-2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23108\" class=\"wp-image-23108 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/4-5-2.png\" alt=\"Python Time Series Analysis\" width=\"582\" height=\"431\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/4-5-2.png 582w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/4-5-2-150x111.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/4-5-2-300x222.png 300w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><p id=\"caption-attachment-23108\" class=\"wp-caption-text\">Plotting a Density Plot in Time Series Python Analysis<\/p><\/div>\n<h3><strong>Autocorrelation Plot in Time Series<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">This gives us how the elements of the series correlate to each other.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from pandas.tools.plotting import autocorrelation_plot\r\n&gt;&gt;&gt; autocorrelation_plot(series)<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x08C5CA90&gt;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23109\" style=\"width: 621px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/5-4-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23109\" class=\"wp-image-23109 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/5-4-1.png\" alt=\"Python Time Series Analysis\" width=\"611\" height=\"442\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/5-4-1.png 611w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/5-4-1-150x109.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/5-4-1-300x217.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/a><p id=\"caption-attachment-23109\" class=\"wp-caption-text\">Autocorrelation Plot in Time Series Python Analysis<\/p><\/div>\n<h3><strong>Plotting a Lag Plot in Time Series<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">Such a plot tells us whether a time series is random. If you can identify a structure in the plot, the data isn\u2019t random.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-matplotlib-tutorial\/\" target=\"_blank\" rel=\"noopener\">Do you know about Python Matplotlib<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from pandas.tools.plotting import lag_plot\r\n&gt;&gt;&gt; lag_plot(series)<\/pre>\n<p><strong>&lt;matplotlib.axes._subplots.AxesSubplot object at 0x08EF4FF0&gt;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pyplot.show()<\/pre>\n<div id=\"attachment_23110\" style=\"width: 612px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/6-4-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-23110\" class=\"wp-image-23110 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/6-4-1.png\" alt=\"Python Time Series Analysis\" width=\"602\" height=\"438\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/6-4-1.png 602w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/6-4-1-150x109.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/6-4-1-300x218.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/a><p id=\"caption-attachment-23110\" class=\"wp-caption-text\">Plotting a Lag Plot in Time Series in Python Analysis<\/p><\/div>\n<p>So, this was all in Time Series Analysis in Python. Hope you like our explanation.<\/p>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>Time series analysis is used when data points are collected over time\u2014like daily stock prices, monthly sales, or hourly weather readings. These types of data often show patterns such as trends, seasonality, and cycles. Python offers several libraries for handling time series, including Pandas for indexing and manipulating datetime objects, and statsmodels and Prophet for modelling and forecasting. This data is used in many industries for prediction and decision-making.<\/p>\n<p><span style=\"font-weight: 400\">Hence, in this Python tutorial, we discussed what Time Series is, its analysis in Python and plotting in Python. Now you know how to plot it in different forms. Got any questions? Leave them in the comments below.<\/span><br \/>\n<strong>See also &#8211;\u00a0<\/strong><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-django-tutorial\/\" target=\"_blank\" rel=\"noopener\">Python Django\u00a0<\/a><\/strong><br \/>\n<a href=\"https:\/\/en.wikipedia.org\/\"><strong>For reference<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Python tutorial, we will learn about Python Time Series Analysis. Moreover, we will see how to plot the Python Time Series in different forms, like the line graph, Python histogram, density plot,&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":23140,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[10640,10891,10892,10893,10894,14727,14731,14732,15873,16030],"class_list":["post-23104","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python-line-chart","tag-python-time-series","tag-python-time-series-analysis","tag-python-time-series-example","tag-python-time-series-library","tag-time-series-analysis-in-python","tag-time-series-in-python","tag-time-series-python","tag-what-is-python-time-series","tag-what-is-time-series"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Time Series Analysis - Line, Histogram, Density Plotting - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn what is Time Series in Python, Plotting Line Graph, Python Histogram, Density Plot, Autocorrelation Plot, Lag Plot\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-time-series\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Time Series Analysis - Line, Histogram, Density Plotting - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn what is Time Series in Python, Plotting Line Graph, Python Histogram, Density Plot, Autocorrelation Plot, Lag Plot\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-time-series\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-28T04:00:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-29T07:08:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Time Series Analysis - Line, Histogram, Density Plotting - DataFlair","description":"Learn what is Time Series in Python, Plotting Line Graph, Python Histogram, Density Plot, Autocorrelation Plot, Lag Plot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-time-series\/","og_locale":"en_US","og_type":"article","og_title":"Python Time Series Analysis - Line, Histogram, Density Plotting - DataFlair","og_description":"Learn what is Time Series in Python, Plotting Line Graph, Python Histogram, Density Plot, Autocorrelation Plot, Lag Plot","og_url":"https:\/\/data-flair.training\/blogs\/python-time-series\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-07-28T04:00:59+00:00","article_modified_time":"2026-04-29T07:08:52+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Time Series Analysis &#8211; Line, Histogram, Density Plotting","datePublished":"2018-07-28T04:00:59+00:00","dateModified":"2026-04-29T07:08:52+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/"},"wordCount":631,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg","keywords":["Python Line chart","Python time series","Python Time Series analysis","Python Time series example","Python Time Series library","Time series analysis in Python","Time series in Python","Time series Python","What is Python Time Series","what is Time series"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-time-series\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/","url":"https:\/\/data-flair.training\/blogs\/python-time-series\/","name":"Python Time Series Analysis - Line, Histogram, Density Plotting - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg","datePublished":"2018-07-28T04:00:59+00:00","dateModified":"2026-04-29T07:08:52+00:00","description":"Learn what is Time Series in Python, Plotting Line Graph, Python Histogram, Density Plot, Autocorrelation Plot, Lag Plot","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-time-series\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Time-Series-Analysis-01.jpg","width":1200,"height":628,"caption":"Python Time Series Analysis - Line, Histogram, Density Plotting"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-time-series\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Time Series Analysis &#8211; Line, Histogram, Density Plotting"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=23104"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23104\/revisions"}],"predecessor-version":[{"id":148070,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23104\/revisions\/148070"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/23140"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=23104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=23104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=23104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}