How to plot dates on the x-axis using Seaborn (or matplotlib)
<p>I have a csv file with some time series data.  I create a Data Frame as such:</p>

<pre><code>df = pd.read_csv('C:\\Desktop\\Scripts\\TimeSeries.log')
</code></pre>

<p>When I call <code>df.head(6)</code>, the data appears as follows:</p>

<pre><code>Company     Date                 Value
ABC         08/21/16 00:00:00    500
ABC         08/22/16 00:00:00    600
ABC         08/23/16 00:00:00    650
ABC         08/24/16 00:00:00    625
ABC         08/25/16 00:00:00    675
ABC         08/26/16 00:00:00    680
</code></pre>

<p>Then, I have the following to force the 'Date' column into datetime format:</p>

<pre><code>df['Date'] = pd.to_datetime(df['Date'], errors = 'coerce')
</code></pre>

<p>Interestingly, I see "<code>pandas.core.series.Series</code>" when I call the following:</p>

<pre><code>type(df['Date'])
</code></pre>

<p>Finally, I call the following to create a plot:</p>

<pre><code>%matplotlib qt
sns.tsplot(df['Value'])
</code></pre>

<p>On the x-axis from left to right, I see integers ranging from 0 to the number of rows in the data frame.  How does one add the 'Date' column as the x-axis values to this plot?</p>

<p>Thanks! </p>

<p>use the <code>time</code> parameter for <code>tsplot</code></p>

<p>from docs:</p>

<pre><code>time : string or series-like
    Either the name of the field corresponding to time in the data DataFrame or x values for a plot when data is an array. If a Series, the name will be used to label the x axis.
#Plot the Value column against Date column
sns.tsplot(data = df['Value'], time = df['Date'])
</code></pre>

<p>However <code>tsplot</code> is used to plot timeseries in the same time window and differnet conditions. To plot a single timeseries you could also use <code>plt.plot(time = df['Date'], df['Value'])</code></p>

python matplotlib seaborn timeserieschart