Pandas 'sep' Command Not Working for Text File

1 week ago 4
ARTICLE AD BOX

I have the following (shortened) list of data (State Vector for an arbitrary satellite):

0.0000000000000000e+00 6.0513311190355308e+06 -2.3889553726207524e-10 -3.9014601994371545e+06 4.0317846206431714e+03 3.8291459195655465e-13 6.2534698530736323e+03 6.0000000000000000e+01 6.2814546997969141e+06 -2.1547630723460402e-10 -3.5189951483909814e+06 3.6365437026494615e+03 3.9747629338942394e-13 6.4912804845635892e+03 1.2000000000000000e+02 6.4874368013717895e+06 -1.9122893833881666e-10 -3.1230055632686536e+06 3.2273264768883478e+03 4.1051037644047142e-13 6.7041432146196730e+03 1.8000000000000000e+02 6.6684857739182003e+06 -1.6624662034997759e-10 -2.7150133485952844e+06 2.8057056856011409e+03 4.2196674729228027e-13 6.8912399491195329e+03 2.4000000000000000e+02 6.8239057929480085e+06 -1.4062536766896203e-10 -2.2965865385329206e+06 2.3733017415810027e+03 4.3180137573980832e-13 7.0518516202458586e+03 3.0000000000000000e+02 6.9530995335844243e+06 -1.1446365031074199e-10 -1.8693332704651831e+06 1.9317765004511439e+03 4.3997646441137634e-13 7.1853609500748316e+03 3.6000000000000000e+02 7.0555704662575210e+06 -8.7862015455115200e-11 -1.4348956044516372e+06 1.4828268736641733e+03 4.4646059403510447e-13 7.2912548229570803e+03 4.2000000000000000e+02 7.1309247650135579e+06 -6.0922701014274769e-11 -9.9494321230727958e+05 1.0281783067715287e+03 4.5122884419242508e-13 7.3691262575721948e+03 4.8000000000000000e+02 7.1788728211037908e+06 -3.3749242702520819e-11 -5.5116696056394966e+05 5.6957814803005249e+02 4.5426288909457014e-13 7.4186759710774677e+03 5.4000000000000000e+02 7.1992303560365383e+06 -6.4460761178893076e-12 -1.0527241197016669e+05 1.0878893282585877e+02 4.5555106801399719e-13 7.4397135293403717e+03 6.0000000000000000e+02 7.1919191298133684e+06 2.0881864634490553e-11 3.4102672948689078e+05 -3.5241839026625024e+02 4.5508843009997846e-13 7.4321580788326683e+03

This data is saved as a text (.txt) file.

I use pd.read_csv to import this file into Python, with the following line.

df = pd.read_csv("c:\\Location\\Sat_Data.txt",sep=r'\s+')

The output still comes out as N rows by 1 columns, even though I included the sep command.

Output Example:

EphemerisTimePosVel 0.0000000000000000e+00 6.0513311190355308e+06 -2.388955e-10 -3.901460e+06 4031.784621 3.829146e-13 6253.469853 6.0000000000000000e+01 6.2814546997969141e+06 -2.154763e-10 -3.518995e+06 3636.543703 3.974763e-13 6491.280485 1.2000000000000000e+02 6.4874368013717895e+06 -1.912289e-10 -3.123006e+06 3227.326477 4.105104e-13 6704.143215 1.8000000000000000e+02 6.6684857739182003e+06 -1.662466e-10 -2.715013e+06 2805.705686 4.219667e-13 6891.239949 2.4000000000000000e+02 6.8239057929480085e+06 -1.406254e-10 -2.296587e+06 2373.301742 4.318014e-13 7051.851620 ... ...

I ultimately want a table with N rows and 7 columns (time, pos_x, pos_y, pos_z, vel_x, vel_y, vel_z).

I'd appreciate any help as to why the sep command isn't seperating based on empty white space (space or tabs), or if there is another way to do this, please let me know.

And if there's anything else I can provide please let me know.

I also tried inputting the text file raw, then using df['EphemerisTimePosVel'].str.split(' ',expand=True) to split the columns, but that didn't work either.

This method gave an output where the table had upwards of 14 columns, many of which having empty cells. I can provide an output example of this if requested.

Read Entire Article