Skip to content Skip to sidebar Skip to footer

Trying To Understand Pandas Dataframes

I have a space-delimited .dat file, for which the first few lines look like this: 1 SDSSJ000005.95+145310.1 2.49900 * 0.000e+00 0.00 NA -999.000 -999.000 -999.000 -999.000 -999.000

Solution 1:

To me this seems buggy, and possibly related to this issue. An easy work around is just to use set_index afterhand:

data = pd.read_csv('todo.dat', sep = ' ',
                   names = ['no', 'NED', 'z', 'obj_type','S_21', 'power',
                            'SI_flag','U_mag', 'B_mag', 'V_mag', 'R_mag',
                            'K_mag', 'W1_mag', 'W2_mag', 'W3_mag', 'W4_mag',
                            'L_UV', 'Q', 'flag_uv']).set_index('z')

Post a Comment for "Trying To Understand Pandas Dataframes"