In Python, however, you do need to specify which library the functions you are using come from, even after importing them. I could choose to explicitly specify that filter() comes from dplyr using :: like this: Sepal.Length Sepal.Width Petal.Length Petal.Width Species There are many ways to install python libraries, but if you installed python in the same way that I did above, the way that I usually install libraries is in the terminal on my computer, where I write: Like with R, you need to install a library before you can use it. The main python libraries you’ll need to start with are NumPy and pandas. Like R, Python is mostly useful for data science because of the add-on libraries that some very smart people wrote to help us work with data. You can install a jupyter notebook extension within the VS Code IDE (fortunately, there is no need to install jupyter notebooks or anaconda separately). So if you want to fit in with the cool Python kids, I’d recommend working with Jupyter notebooks (.ipynb files) in the Visual Studio Code IDE. While, these days, you can use Python together with quarto within RStudio, this isn’t really what Python users do (yet…). It definitely took me a minute to orient myself.) Jupyter notebooks (You might want to watch a couple of YouTube videos to get started with VS code if you’ve never seen it before. Then you can select your preferred python installation within VS code and you’re good to go. While I used to use Python in Jupyter notebooks via the Jupyter notebook IDE installed using anaconda, I’ve found that the simplest approach to getting Python up and running is now to install the latest version of Python directly from the python website and install the Visual Studio Code IDE. Managing Python installations on my computer used to give me a headache. These are important things to know about to be a well-rounded Python programmer, but for just doing simple data analysis with pandas data frames, these needn’t be the focus. There is a lot of information in there, and to be fair, you can skip a lot of it when you’re starting out (like the stuff about sets, tuples, and arrays). The one that I found most useful was Wes McKinney’s Python for Data Analysis book (Wes is the creator of pandas). There are a lot of resources out there for learning Python. I won’t be talking too much about things like SciPy, arrays, or scikit-learn here. Note that this blog post will focus on working with data in Python using pandas. Obviously this post won’t be exhaustive, but if you’re a tidyverse R user who is looking to learn Python, this post can hopefully serve as a helpful launching point and will provide some relatable context on your Python journey. In this post, I’m going to introduce you to the world of data analysis with Python from an R perspective. That said, already knowing R does mean that the learning curve for learning Python won’t be too steep (but it will still take a few months of regular use to reach competence). While there are certainly similarities between R and Python, don’t assume that knowing how to use one will automatically mean that you know how to use the other. If you’re looking for a job, you’re going to be much more employable if you’re already comfortable with Python. If you’re working with software engineers, they’re going to be much happier working with you if you use Python. If you’re doing machine learning, Python is still light-years ahead of R. Why did I decide to learn Python? I’ve been using R my whole data science life, and while I still think that R (with the tidyverse) is still the best language for data wrangling and data visualization, there is no denying that as a data scientist these days, Python is a required skill. (But don’t worry, I’m still an R Lady at heart.) The end result is that I now consider myself a Python user. For those of you who teach, you’ll know that the best way to make sure you know something really well is to teach it. In fact, not only did I have to use Python, but I also had to teach Python. This year was the first time I had to actually sit down and really use Python for real projects. To be fair, I’ve used Python here and there over the years, but it was never my primary language (that has always been R). I have a confession to make: I am now a Python user.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |