2
I have an output of sensor data that has the following desired structure:
--- Beginning ---
$LAGM,Colar03,Yellow,32262,-31226,-5120,-104,40,190,1662.00,1670.00,236.00,MGAL $GPGGA,113203.181,2026.6812,S,05443.4264,W,1,03,3.4,0.0,M,4.8,M,,0000*68 $GPGSA,A,2,07,23,30,,,,,,,,,,3.5,3.4,0.9*3E $GPGSV,3,1,12,30,54,247,37,07,54,185,38,09,51,135,32,28,37,352,10*7E $GPGSV,3,2,12,23,31,096,43,06,20,297,26,03,18,029,30,08,10,088,33*77 $GPGSV,3,3,12,02,10,263,24,05,05,218,28,16,00,146,,27,00,118,*70 $GPRMC,113203.181,A,2026.6812,S,05443.4264,W,000.0,000.0,241017,,,A*63 $GPVTG,000.0,T,,M,000.0,N,000.0,K,A*0D
--- End ---
Where the information in the Dataframe of Pandas is positioned sequentially, as a table and its records. It turns out that the sensor, in some blocks of code, simply did not record some data, getting missing information, according to the following block:
--- Beginning ---
$LAGM,Colar03,Yellow,6,27904,6144,332,-172,-216,1536,109,24,MGAL $GPGGA,120025,0,N,0,E,0,0,0,0,M,0,MŽÆF¦F&Ö $GPRMC,120025,V,0,N,0,E,0,0,280606,,,N*78 $GPVTG,0,T,,M,0,N,0,K,N*02
--- End ---
It is possible to notice that information is missing, as well as the existence of Non-ascii characters (This is another treatment). My main contribution in the master’s degree is the pre-processing, where it consists in rescuing these missing lines and putting an average between the values, rescuing the lost information.
However, in excel it is possible to perform this "on the arm" according to the gif animated below:
Where it drags the existing records down so we can add new data in the created lines, but I could not find a way to add this information in Pandas like the image.
I wonder, it is possible to perform this action of inserting a line with new information in Pandas with some function or even circumvent it with Python?
Thank you Alexciuffa, that solved my problem very efficiently. Now I just need to develop an iteration that goes through all the data and calls this function. Again thankful!
– Paulo Rezende