AI Briefing
KO

Mirror Mirror Study Session 4

·2018.01.23 00:00

Key point

We learned Excel processing with glob and pandas, plus Google Sheets integration with gspread.

Details

Based on Chapter 3.4~3.6 summary prepared by Boram, we started by organizing how to handle multiple workbooks.

  • Using glob and os to parse file paths and filenames, we created a list of input files and used a for loop to iterate through each file and check its structure.
  • We extracted filenames with os.path.basename, and used xlrd's book.nsheets, sheet.nrows, sheet.ncols to check the number of worksheets and rows/columns.

When merging multiple workbooks into one, we used pandas's concat. We controlled the combination by specifying axis=0 for row-direction concatenation and axis=1 for column-direction concatenation.

We also calculated statistics per worksheet. Using basic statistical functions like pandas.dataframe(column to calculate).sum(), we computed sums and averages, turned each worksheet's results into a dataframe, and then combined them with merge to create overall statistics.

In the advanced section, we learned how to connect Python scripts with Google Sheets using gspread. After setting up public access to the Google Drive API and creating a key file for authentication, sharing the spreadsheet with the client_email account sets up an environment for reading and writing from Python.

With this integration in place, you can organize data pulled from queries into a spreadsheet, or semi-automate the task of periodically updating data records. Having spent half the book testing whether Python can be used more efficiently than Excel, the process has now moved beyond filtering and simple calculations toward real practical applications at work.

There was a strong sense of accomplishment in having diligently completed half the study, and the growth of participants was noticeable. We reached a level where we could explain unfamiliar content to others and discuss code readability, and we're now looking forward to next week's hackathon being a good experience as well.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.