ChatGPT — Can I stop coding yet?
Following on from my previous articles ChatGPT — The Next Tech Revolution and ChatGPT — Is the role of a Data Scientist already obsolete. I promised to do some real world examples of how ChatGPT might be used in data related applications.
Last night I was tuned out on the couch watching YouTube videos (allowing YouTube to randomly select my next video) and the interview with Ben Shapiro and Ron DeSantis came on. Only half paying attention, a discussion about Florida’s handling of Covid 19 transpired. I had made the conscious decision long ago to switch off from all of the political and media insanity that was going on around Covid 19. It dawned on me while this interview was on, that, I had no clue what the stats now say post pandemic heights.
Triggering my inner data analyst, I wanted to jump onto my laptop and whip up some fancy graphs and do some analysis on the whole Covid journey, from day 1 until now. Then my inner laziness got the better of me and I did no such thing! However, the mind wandered to the thought, I wonder if I can get ChatGPT to produce the fancy graphs for me (tbh by this stage I just wanted to see some cool graphs and appease my visual OCD!).
So I picked up the iPhone and started keying into ChatGPT. To set the scene, my 1st thought was to ask it to write some python code and output some graphs using plotly. However, I’ve been working on a few ReactJS personal projects of late so I thought, let’s try it in React. Here’s my journey:
Note mistake number 1. It didn’t source data from an api as requested. So I asked it to change it:
Succes, it changed the source of the data. However, mistake number 2, the code returned no errors but it also didn’t return a graph!
So I asked it to check it’s code. Note from here I won’t paste all of the returned code.
Success! I pasted the code into an existing React app i’m working on and I have a graph, but I only have covid cases returned.
Note to self, you have to tell it exactly what you want and how you want it.
Success! We have a graph but they’re all on the same Y axis and Deaths looks tiny, let’s change it.
Mistake 3, it dropped recovered cases.
Success! We have a graph.
Now that I have a graph (albeit not very pretty!) I decided to make it explain what i’m seeing, I’ll let you be the judge of it’s responses.
Conclusion
I was suprised at the ease at which it wrote this code. I do have to come clean and admit I spent about 30mins fumbling around with this to understand the nuances of how to ask it to write the code successfully. There were various failed attempts and as I kept asking it to correct itself, it seemed to start confusing which code output I was asking to fix and it would end up with some fairly out there results.
I had to go back to the start a few times and use the right language to return the right results. However, now that I have learnt it’s nuances, to replicate this again would take me less than 2 minutes. Although this is a pretty simple React graph, 2 minutes to ask ChatGTP to write the code is certainly quicker than coding it myself from scratch.
I am not a programmer by any stretch, I write code for data applications and build web applications as needed but I don’t define myself as a “programmer” ( I am always in awe of the capabilties of top notch programmers). However, I am always working on something in the data space and I have a number of web development projects underway that require code to be written. It’s no secret that writing code for things like boilerplates becomes mind numbing and tedious very quickly. The time and financial savings of having a bot write even the most basic code such as boilerplates is going to be invaluable for businesses into the future.
From a data analyst and engineering perspective. This tech has some real world use cases to sit within our ecosystems to enhance our capability and remove much of the tedious processes we have to go through to turn data into a useable and valuable asset.