How I Code Faster - GitHub Copilot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
dead nerds I've been using GitHub co-pilot this past year in order to speed up my python coding workflow so I'm going to share my best practices for using this tool for a review now GitHub co-pilot not to be confused with this co-pilot is located right inside some of the most popular code editors for me it's VSS code anyway this bad boy provides coding recommendations right here this is really great for below average coders as now you don't have to have a separate chat GPT window open when coding to show just how inferior you are to those senior developers hey what are you looking at oh nothing now it's also great for those that know their low performers as it even comes with a chat interface to ask it your deepest darkest questions which you can quickly clear so your friends don't see now this past year I built a python web app from scratch which to be honest I probably couldn't have done without the help of co-pilot I ran into a whole host of issues trying to integrate my app with a live SQL database turns out there's not a lot of documentation for this and this AI tool saved my butt and it's not only me fanboying this tool in a bigger study it was found that those that use this not only completed more task but also completed them in less than half the time wowzers look at that P value and it's not just a speed Improvement apparently three out of four programs are finding more fulfillment with some even claiming to find the answer to life the universe and everything now I'd be remiss to mention that this has some major drawbacks especially when used improperly there's new data to support that we are starting to see a downward pressure on code quality due to these AI coding assistance with this white paper specifically analyzing 150 million lines of code and showing an in increase in code CH and what the heck is this term well I looked it up and it's the percentage of lines that are reverted or updated less than 2 weeks after being authored oh and this number is projected to double in 2024 compared to its 2021 pre-ai Baseline to put it nicely with everyone feeling like they're living more fulfilled lives they're becoming lazy AF with their coding and putting all that that these large language models learn from the internet into your code but I have a few lessons on preventing this hence why I made this video anyway quick disclaimer this video is not sponsored by get up co-pilot or Microsoft nor they have any review but it is supported by those of you that purchase my course certificates and notes specifically I just launched my YouTube course chat gbt for data analytics and it shows you everything you need to know in order to start analyzing data from day one and speed up your workflow all right enough of me happen let's actually get into building a project with GitHub copilot to show you how I code fast now like any great chot bot these days you're going to have to pay money for it I have a yearly subscription pay $100 a year however it is free if you're a student if you're using this for work with secure data you need to cover your ass with the co-pilot business account they're offering things like Enterprise grade security safety and privacy and with this your boss now knows about it and so if anything goes wrong they'll get fired and not you once your account's set up you can then install it within your editor I don't like to pay for my products nor am I a hardcore programmer so I'm going with VSS code in here we have to enable it by going to extensions there's two extensions you need to install versus this one which allows you to use it right within the text editor itself the other extension is the chat extension which basically provides chat GPT along a side panel inside of here after you install those extensions it should walk you through the account setup and you'll know you're connected by the status icon that you can title GitHub co-pilot on or off all right we have GitHub co-pilot chat on the left hand side of the window along with it working inside of a file now that it's all set up let's actually get into building a project with co-pilot we're going to be building a data analytics project from scratch and we need three major things first a data set to actually analyze the data second a python notebook to show off to all your non-coders friends that you can do analysis with python and third a read me to summarize all your results for the data set first we could have chat GPT generate this data set but I'm going to shamelessly plug my own data set that you can get here for free anyway this has key details about data analyst job postings through around the US so in my new project I'm going to drag and drop that new data set into here so we have our data set now we need to move into our analysis using a slash command I'm going to go ahead and generate a new notebook I'm also going to add some key information to connect to the data set along with performing some exploratory data analysis before creating the notebook it prompts me with a list of steps that it's going to be walking through in order to generate this these all look good to me so I'm going to say create notebook all right not going to lie this is pretty good it generates a pretty robust amount of code to actually go through and analyze and look into this data set but does it work so let's jump into running it starts off by importing the libraries and then loading the CSV we can actually check out the data set here and then it moves into cleaning where it looks like we ran into our first error and we can tell this by this error message right here now I run into errors quite a bit and there's a few ways you can go about tackling this one you can just highlight all your code rightclick it and go to this co-pilot button and then from here select fix this or you could select it all type slash fix and then provide a description of what's wrong here but I like this button down here of fix using co-pilot it still used that slash fix command but it pastes in that error message that we got below so that way co-pilot knows what's going on from here it shows us the original code on the left which is in red and then that that we're fixing on the right I'll be honest this looks exactly the same code so I'm going to click this button of regenerate and I had to press it a few times to actually get to a good one so this isn't perfect now we could run around all day and try to get copile to fix this but sometimes it takes an actual programmer that understands what's going on here to see what's wrong and right now it's using a generic column name for a column name in order to search for and clean up basically column name if we actually scroll up to the columns does not exist copilot hallucinated this but there's a way we can fix this and actually set co-pilot up for better success there's multiple items being fed to the large language model behind co-pilot first is all that data in the editor along with any prompts that you provided the other thing that can actually help with this are open tabs so in this case it probably would help to keep something like the data set open during this so we can see those different colum titles and then generate it into here now all of this feeds into the context window and you can only send so many tokens to and if we look at our data set there's a whack of tokens and so it's not going to send this all to large language model but I have a better idea instead going back to kaggle I can look and see that there's actually different notebooks that were used to analyze this data set one being mine of course with this code download I can then put it into our project and then open it inside of our Editor to then be used by this large language model hey yo editor Luke here with some real talk if you're going to actually use somebody else's code to generate some new code make sure you the right thing and site their sources don't be an and not site it all right back to real Luke so let's try this again by generating this notebook now with this tab open all right so not so bad we able to get through a lot more of these things specifically we're actually get through this data cleaning without getting errors now one thing we get caught up on was visualizing the data which if you look at it we actually did generate a graph but when it went to visualize the next graph it generated an error let's try to fix this 5 minutes later so I'll be honest I gave up on troubleshooting this era that was going through it could couldn't actually fix it with co-pilot I could have figured it out through coding at least I'm telling myself that but I am finding that GitHub co-pilot isn't necessarily the best when it comes to fixing errors nonetheless I commented out all that different code that we had here that it was causing the error and for visualizing the data we have some really interesting results one we have a bar chart of all the different numerical columns then we have this pair plot showing how these different numerical columns actually can relate to each other now it's pretty cool that co-pilot generated all this different code for this but if you're new to maybe programming with Pyon what the you may need co-pilot to explain some of this to you this can be done by selecting any of the code and then using the slash command explain in this case we're looking at the data cleaning and it goes through and provides a lot of background on what are all the different steps it took and why it took it intermission Luke here and going back to that eror troubleshooting that we dealt with previously this seems to be one of the biggest pain points that I've dealt with co-pilot with working with it over the past year I calculated the time that I spend coding and I find that the the majority of it spent fixing errors and you don't have to take my word for it go to stack Overflow and look at any problem there now the team behind co-pilot recently announced that they were upgrading their model and using the most advanced model from openai GPT 4 and when I use this model inside of Chad GPT it typically gets my answers correct yet somehow in co-pilot it seems to still be getting this wrong well if we investigate the logs behind this error message that we're trying to troubleshoot with it we can see that GitHub co-pilot chat yeah it does use GPT T 4 sometimes but also it reverts back to gbt 3.5 turbo which is not a bad model but it's no gb4 but mainly I feel kind of betrayed cuz Microsoft's telling me they're using gbt 4 but they're not necessarily using it all the time now even though I have all these frustrations with co-pilot when I go to the 2023 developer survey and look at the top AI coding assistants it's not even close co-pilot is the leader tab9 and code whisper are the next two closest options and if we look at this fancy visualization we can see that actually people that use these two options are more switching to co-pilot than vice versa so I think it's pretty apparent that co-pilot is a leader in this area right now all right so let's jump back in and finish this analysis for this I want to analyze the title column want to see what type of different jobs are in there I commonly use this by just generating a comment in Python you note this comment by a hashtag at the beginning of it it looks like it's going to break us into the steps and it's going to first count the frequency of those titles I'm going to press tab to accept this and it gives me this code right here and I can use a shortcut of option square bracket in order to sort through all the different recommendations now it's going to move into the bar chart if you press controll enter you'll then get a popup on the rightand side that has multiple different suggestions it should have up to 10 in this case it looks like it has five so let's run this code and Bam we get this graph showing the top 10 rolls with as expected data analyst at the top let's now get into the final step of generating that read me detailing what what we did for this project and I prompted generate text for a readme file detailing the contents of job analysis python notebook so this looks pretty good it goes into what the contents are of the jupyter notebook itself which I never had it actually do before and then goes into some requirements and usage for it I'm going to go ahead and create that readme and then from there just copy and paste that over here and now we have our readme that details all the different contents requirements and usage pretty good that I didn't have to write any of this and it's just all right here given to me and now we have a full project that we built in less than 10 minutes not going to lie looking back on using this tool over the past year I wish I would have had this when I first started coding in order to speed up my workflow and help with troubleshooting all those issues that I run into all right as always if you got value out of this video smash that like button with that I'll see you in the next one
Info
Channel: Luke Barousse
Views: 45,094
Rating: undefined out of 5
Keywords: data viz by luke, business intelligence, data science, bi, computer science, data nerd, data analyst, data scientist, how to, data project, data analytics, portfolio project, sql, excel, python, power bi, tableau, data engineer
Id: z7t95HqI5Ok
Channel Id: undefined
Length: 10min 49sec (649 seconds)
Published: Sat Feb 03 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.