Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

How To Show Second Row Using Pandas in Python With Duplicate Row Names

$
0
0

I am writing a script to read from an Excel sheet, that I can't modify, that has several duplicate rows.

The issue I am having is that it appears to stop adding to the index after finding the first row.

I can't figure out how to get it skip the first row and index only the second.

 df = pd.read_excel(aisc_excel_file)    # Open the profiles.lis file for writing    with open(profiles_lis_file, 'w') as profiles_lis:        # Write the header to the profiles.lis file        profiles_lis.write("PROFILE\tWIDTH\tHEIGHT\n")        # Iterate through rows in the AISC DataFrame and write to profiles.lis        for index, row in df.iterrows():            profile_name = row['AISC_Manual_Label']            width = row['h, in']            height = row['b, in']            # Write the profile data to the profiles.lis file            profiles_lis.write(f"{profile_name}\t{width}\t{height}\n")

Here is the AISC Excel sheet:https://www.aisc.org/globalassets/product-files-not-searched/manuals/aisc-shapes-database-v16.0.xlsx

I have two "AISC_Manual_Label" row labels, I need the data from the second.

I have tried the df.Duplicated but it always returns a boolean and the index stays the same.

I also read something about series but was not able to get the second row.

Any help would be greatly appreciated.

Thank you.


Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>