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)