Extracting Excel Coordinates from Python

Asked 2 years ago, Updated 2 years ago, 18 views

I extracted only the files I wanted using the if clause and put the data in the name-_list I did this again with the for syntax, but the price comes out weird. In this way, we aim to list the net income in the financial statements.

    name_list = []
    for i in os.listdir():
        If 'Financial Position Statement' in i:
            name_list.append(i)

    for filename in name_list:
        df = pd.read_csv('{}'.format(filename), encoding = 'euc-kr')
        df_boolan = df == 'Net profit'
        x = df_boolean.sum(axis=1).values.argmax()
        y = df_boolean.sum(axis=0).values.argmax()
        num = df.iloc[x, y+1]
        print(filename, num)

out

 [Pre-fiscal revision] Half-year report (2011.06) Samsung Electronics' consolidated financial position table.csv  
[Additional attachment] Business report (2011.12) Samsung Electronics consolidated financial position table.csv  
Semiannual Report (2011.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semiannual Report (2012.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semiannual Report (2013.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semiannual Report (2014.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semiannual Report (2015.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semiannual Report (2016.06) Samsung Electronics Consolidated Financial Position Statementcsv  
Semi-annual report (2017.06) Samsung Electronics consolidated financial position table.csv assets
Semiannual Report (2018.06) Samsung Electronics Consolidated Financial Position Statementcsv assets
Semiannual Report (2019.06) Samsung Electronics Consolidated Financial Position Statementcsv assets
Quarterly Report (2011.03) Samsung Electronics Consolidated Financial Position Statementcsv  
Quarterly Report (2011.09) Samsung Electronics Consolidated Financial Position Statementcsv  
Quarterly Report (2012.03) Samsung Electronics Consolidated Financial Position Statementcsv  
Quarterly Report (2012.09) Samsung Electronics Consolidated Financial Position Statementcsv  
Quarterly Report (2013.03) Samsung Electronics Consolidated Financial Position Statementcsv  

python

2022-09-20 22:03

1 Answers

The problem is...

There's a df, and there's a filtered df_boolean.

The coordinates are obtained from df_boolean. Apply the coordinates to the df. I can't get hit.


2022-09-20 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.