import pandas
df = pandas.DataFrame(data, columns=['a', 'b', 'c', 'd'], index=['x', 'y', 'z']
    )
df = df.fillna(0)
df = df.astype(int)
df.to_csv('test.csv', sep='\t')
Python pandas: output dataframe to csv with integers