The NaN value you are getting is because you are trying to print both keys and values at a time for the series ---> a, this is turning out to be Nan :
I have done modification in the code ,this is generating the output as required :
import numpy as np
import pandas as pd
a=np.array([2,2,2,3],dtype="int")
data= ({"A":1,
"B":pd.Series(a).values,
"C":pd.Timestamp("20130203"),
"D":np.array([3]*4),
"E":"Elephant"})
df = pd.DataFrame(data, index=["Firstyear","Secondyear","Thirdyear","Fourthyear"])
print (df)
![image](https://attachment.freshdesk.com/inline/attachment?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NDA2MTg0MTM4NywiZG9tYWluIjoiZWR1cmVrYS5mcmVzaGRlc2suY29tIiwiYWNjb3VudF9pZCI6NDE0NTN9.lwxxnt01yMlbwbe86LK1sYXOwcdfyCLLI-sfEI8aabU)