Week10 niftydata: **ValueError** : The truth value of a DataFrame is ambiguous

for nifty dataset i am using this code
i want to create the same code as created in previous lesson but with new nifty dataset but got error

d=pd.Timestamp(nifty.index[0])
new_index=map(pd.Timestamp,nifty.index[0])
new_nifty=pd.Series(nifty,index=new_index)
but i got this error`
**ValueError** : The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

can some one suggest different code
and how can i make this code work

1 Like

Above, you are passing a DataFrame object (nifty) to pd.Series which is causing this ValueError. You can pass only a single column of nifty to pd.Series.

1 Like

@drago9t
as you’re passing the whole nifty data set in pd.Series , so you’ve to pass the index of all elements rather than passing it for 1 only…like:–

d=pd.Timestamp(nifty.index[0])
new_index=map(pd.Timestamp,nifty.index)
new_nifty=pd.Series(nifty,index=new_index)

@sanjayk i tried for single coulmn but gives no result can you show how to do

@mayankmystery18 just as shown by sir in week 9 during soln I just want to do same thing but with new nifty data set consisting( open ,close etc.)