My code is
import numpy as np
import pandas as pd
ser_1 = pd.Series(np.random.randn(6))
ser_2 = pd.Series(np.random.randn(6))
ser_3 = pd.Series(np.random.randn(6))
df = pd.DataFrame(data= {'Col1': ser_1, 'Col2': ser_2, 'Col3':ser_3 } , )
df
It gives me a table consists of generated rand #s:
Col1 Col2 Col3
0 -0.594436 -0.014419 0.512523
1 0.208414 0.804857 0.261830
2 1.714547 -0.765586 -0.153386
3 -0.834847 -0.683258 -1.341085
4 2.726621 0.379711 -0.276410
5 0.151987 0.622103 0.966635
However, I would like to have labels for the rows instead of 0, 1, ...5, I tried
df = pd.DataFrame(data= {'Col1': ser_1, 'Col2': ser_2, 'Col3':ser_3 } , index=['row0', 'row1', 'row2', 'row3', 'row4', 'row5', 'row6'] )
But as expected it gives me NaNs
Col1 Col2 Col3
row0 NaN NaN NaN
row1 NaN NaN NaN
row2 NaN NaN NaN
row3 NaN NaN NaN
row4 NaN NaN NaN
row5 NaN NaN NaN
row6 NaN NaN NaN
Question is what can be done so that it won't give NaNs and I can still label them?