'Create new independent dataframe from an existing one

Have a dataframe looks like this:

TripId                   time_LAT_LON                                                     
  0      [['2017-07-22 07:49:01',43.96529, -76.50005], ['2017-07-22 07:50:01',43.96046, -76.50513],....

how can I extract LAT and LON values from time_LAT_LON column and save them into a new dataframe for further calculations?

I don't want to modify original dataframe so i think of creating a new dataframe :

new_df=df.copy(deep=true)
for i , sublst in enumerate(new_df['time_LAT_LON']):
            del(sublst[0])

But the time values in original dataframe is deleted too.

by the way , I don't want to iterate through original dataframe and actually want LAT and LON values in new independent dataframe



Solution 1:[1]

You can do something like:

items := ComObjGet("winmgmts:").ExecQuery("Select * from Win32_PnPEntity")._NewEnum
    while items[device]
        MsgBox %        device.Availability[0]
            .   "`n"    device.Caption[0]
            .   "`n"    device.ClassGuid[0]
            ; . "`n"    device.CompatibleID[][0]
            .   "`n"    device.ConfigManagerErrorCode[0]
            .   "`n"    device.ConfigManagerUserConfig[0]
            .   "`n"    device.CreationClassName[0]
            .   "`n"    device.Description[0]
            .   "`n"    device.DeviceID[0]
            .   "`n"    device.ErrorCleared[0]
            .   "`n"    device.ErrorDescription[0]
            ; . "`n"    device.HardwareID[][0]
            .   "`n"    device.InstallDate[0]
            .   "`n"    device.LastErrorCode[0]
            .   "`n"    device.Manufacturer[0]
            .   "`n"    device.Name[0]
            .   "`n"    device.PNPClass[0]
            .   "`n"    device.PNPDeviceID[0]
            .   "`n"    device.PowerManagementCapabilities[][0]
            .   "`n"    device.PowerManagementSupported[0]
            .   "`n"    device.Present[0]
            .   "`n"    device.Service[0]
            .   "`n"    device.Status[0]
            .   "`n"    device.StatusInfo[0]
            .   "`n"    device.SystemCreationClassName[0]
            .   "`n"    device.SystemName[0]
                            
End::
ExitApp

The commented lines was giving error here... you can uncommented and test if you like.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dieisson Silva dos Santos