Using AI with Python
Last year I took a course with Harvard’s CS50P Python because, well, I wanted to learn another language in case Microsoft VBA goes away. Companies are constantly changing up their offerings, so I wanted to be prepared. I did not do it because I thought Microsoft would pair up Excel with Python for data analysis (predominantly). But hey! It goes to show it never hurts to learn something new.
So last year I took that course. I’m not gonna lie: it took a lot of effort to go through those problem sets. I must have averaged 20 hours a week doing the problem sets, on top of the 2 to 6 hours going through the class lectures on videos, taking down notes, especially programming notes.
I tried to save the last quarter for the project, thinking I would need 3 months to come up with an idea, do some research on what libraries I would need, write the program, debug it, and then write a README and develop a video of the program.
But the coursework ate into October.
I did finish by mid-December and got my own nifty program.
The program was to extract data from zoom calls for those meetings that were networking in nature. There’s a particular meeting I go to where everyone who wants to sign in with their name, location, title, email, LinkedIn URL and whatever affinity point they want to list. Not everybody who joined the call entered information about themselves in the chat. I would probably say about 400 to 500 would join the call and around 300 would supply information.
The downloaded information would be a text file.
I had an Excel to extract some of the information but the problem I ran into was that I needed to use array formulas if I wanted data arranged such that it flowed into a pivot table: one row for name, email if provided, LinkedIn URL if provided. Because of the way information came in, sometimes a line with a name and email would show up and then later another row with name and LinkedIn URL would show. I wanted just one row for each person. So, array formulas helped me get to where I wanted to go.
The problem was the array formulas must have eaten up the calculation memory because at some point, the emails would stop working. Each week it was a different row that the emails stopped working.
In addition, my Excel also had a “filering” feature that I could do a pivot table pulling up people whose job titles were “finance’ or “project manager” or “New York”. Whatever your heart’s desire. That part worked.
It was just the email that was not working very well.
The Excel file did involve some managing. It wasn’t a simple dump of the text file into the Excel. I did have to check the formulas to make sure they covered all of the rows of data. Sometimes, in the effort to extract as much email information as I could, I would change the formulas to reduce the number of rows to search.
I wanted to see if Python could extract that data with less work.
And boy, can it. Oh man.
By the way, in this course, I could not use any AI to aid me in developing the programs in the problem sets or in the project. So that stage was done by my brainwork and in the project, I did use Google to find sites like Stack overflow that might answer my questions.
But after the course, there is nothing to stop me from using AI.
I downloaded the program from the course’s VS Code environment because I wanted to use it for my everyday work. The problem was, on my machine I had Jupyter notebook, which turns out to be a different environment with a different extension. VS Code gives codes with a .py extension whereas Jupyter produces programs with an .ipynb extension.
Why are they different? Who knows. I will have to research on the why.
I did finally manage to copy over the program to the Jupyter notebook. During the coursework, I would copy the program into my Excel file as a reference in the future, so my program was in my Excel file. And I did manage to debug the idiosyncrasy of where Jupyter would store and find files.
But I still ran into problems with the program in that it could not find or recognize the Zoom text file. That’s kind of critical to my program.
That’s when I decided to try AI. I’ve been itching to see what AI could do in helping me with Python and this was a perfect opportunity. I chose Bing AI just because I was too lazy to go to ChatGPT and log in. I plugged in the error message along with pieces of my program I thought relevant to the error. My error had to do with the inability to see the Zoom chat text file so I provided the pieces of the program that dealt with that.
Out came 3 possibilities. One of them sounded like a strong candidate.
I plugged that snippet into my program and BOOM, it worked!
The AI saved me hours of searching for an answer.
I imagine that those who are not programmers at all could begin to do some rudimentary programming by bootstrapping themselves. I mean, that’s what I and others do, but there are a lot of people who won’t do that bootstrapping because it does involve some work finding the answers. AI could provide that shortcut.
It is going to be a whole new world out there. We need to get ready for it.