I want to slice my pandas data frame with a variable that contains a pd.date_range, but it is returning Nan for my data
<p>I have loaded data from yahoo finance which includes the headings date, open, high, low, close, volume, adj close. The date is my index for the data frame, and I want to be able to sort this data using the index(date).</p>

<p>The variable month will give an array of the dates that I need, and it will print. The problem is I get Nan values for my data. </p>

<pre><code>from pandas_datareader import data as dreader
import pandas as pd

df = pd.read_csv("cde_data.csv",index_col='Date')
month = pd.date_range('2010-08-01','2016-08-01',freq='m')

print(df.ix[month.values])
</code></pre>

<p>This is the output that I get (I only posted the first 4 rows to save space)</p>

<pre><code>            Open  High  Low  Close  Volume  Adj Close
Date
2010-08-31   NaN   NaN  NaN    NaN     NaN        NaN

2010-09-30   NaN   NaN  NaN    NaN     NaN        NaN

2010-10-31   NaN   NaN  NaN    NaN     NaN        NaN

2010-11-30   NaN   NaN  NaN    NaN     NaN        NaN
</code></pre>

<p>This the df.head() </p>

<pre><code>              Open    High     Low   Close  Volume   Adj Close
Date
1990-04-12  26.875  26.875  26.625  26.625    6100  250.576036
1990-04-16  26.500  26.750  26.375  26.750     500  251.752449
1990-04-17  26.750  26.875  26.750  26.875    2300  252.928863
1990-04-18  26.875  26.875  26.500  26.625    3500  250.576036
1990-04-19  26.500  26.750  26.500  26.750     700  251.752449
</code></pre>

<p>Press any key to continue . . .</p>

<p>Your index is not of type datetime but object. Convert it before using it:</p>

<pre><code>df = df.reset_index()
df.Date = pd.to_datetime(df.Date)
df = df.set_index('Date')
</code></pre>

python pandas dataframe slice