Aug-03-2019, 08:24 AM
Hi,
I have given below table and i want to create dataframe of this table using Dictionary:
How can i declare whole row of "qtr' as NaN here i am confused ?
I have given below table and i want to create dataframe of this table using Dictionary:
2019 2017 2015 2013 2011 qtr1 61000 44900 5000 5000 5000 qtr3 NaN 57000 5000 5000 5000 qtr4 NaN 59000 5000 5000 5000 qtr NaN NaN NaN NaN NaNI am using given below code but no luck :
import pandas as pd df2 = { 2019 :{ 'qtr1':61000, } , 2017 :{ 'qtr1':44900,'qtr3':57000,'qtr4':59000}, 2015 :{ 'qtr1':5000,'qtr3':5000,'qtr4':5000}, 2013 :{ 'qtr1':5000,'qtr3':5000,'qtr4':5000}, 2011 :{ 'qtr1':5000,'qtr3':5000,'qtr4':5000} } ndf = pd.DataFrame(df2) print(ndf)
How can i declare whole row of "qtr' as NaN here i am confused ?