Home Iterate over rows of Pandas dataframe
Reply: 0

Iterate over rows of Pandas dataframe

user814
1#
user814 Published in May 21, 2018, 3:00 am

I have df like:

CELLID  lon       lat         METER           LATITUDE_SM LONGITUDE_SM  Path_ID
2557709 5.286339 51.353820 E0047000004028217  51.3501      5.3125    2557709_E0047000004028217

For each Path_ID(str) I would like to iterate the loop and would like to achieve df1 like:

Path_ID                    METER          LATITUDE_SM  LONGITUDE_SM
2557709_E0047000004028217 E0047000004028217  51.3501    5.3125 
Path_ID                   CELLID            Lon           lat
2557709_E0047000004028217 2557709         5.286339     51.353820

I have many rows in the df. I am doing something like

for row in df.iterrows():
    print row ['Path_ID'],row['METER'],row['LATITUDE_SM'], row ['LONGITUDE_SM']
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308141 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO