This is my dataframe
      ticker        date   dateValue
549      RCG  2015-01-02    10
692      RCG  2015-01-05    8
I want to have this have reindex
foo =  foo.reindex(index=['2015-01-01', '2015-01-02'])
ticker        date   dateValue
RCG  2015-01-01    N/A
RCG  2015-01-02    10
Instead I get
       ticker date   dateValue
2015-01-01    NaN  NaN          NaN
2015-01-02    NaN  NaN          NaN
                You can simply set the index:
df = pd.DataFrame({'ticker': ['RCG','RCG'], 'date': ['2015-01-02','2015-01-05'], 'dateValue':[10,8]}, index=[549, 692])
df.set_index('date', inplace=True)
print(df)
            dateValue ticker
date                        
2015-01-02         10    RCG
2015-01-05          8    RCG
Is it the expected result ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With