The Snake Installation
Googling the word "python" returns an interesting array (pun intended) of image results, like snake photos, code snippets, and Python language icons. While I don't like snakes, I, fortunately, don't have ophidiophobia either. This means I can easily scroll past the close-up shots of constrictor snakes to get the Python programming language graphics I want to use.
Python in Power BI
It's important to point out that while knowing Python can be helpful in using Power BI, it absolutely isn't required. In fact, I think that if you're a Power BI developer, there's far more of an impact from learning DAX than there is from learning Python. They are different languages with different uses. That's not to say that learning Python isn't useful. But rather, if you have to learn one language, DAX likely takes less time to learn (at least initially) and has a much bigger impact specifically in Power BI.
However, I still love Python. I could write code in it all day if I wanted to. I use Python for querying online data sources (APIs and zipped folders for example) to create useable data tables. I also use it to run algorithms or machine learning models quite a lot. I sometimes use it to create data visualizations. I definitely use R more often than Python though to build data visualizations, both within Power BI and in external IDEs (Spyder or RStudio for example).
In the Power Query Editor
In one of the latest videos in my Power BI Weekly serial course, I illustrate how to use Python to create a new query in Power Query by initially choosing the Python script data connection option. While this example initially looks like a single process script, it really breaks down into four steps.
We can also use Python to run a script on an existing query within Power Query. In an earlier video for this same serial course, I show how to push an existing data table into Python code to run as an applied step of its own in a query we already started building and transforming. Note the issue with using dates between Python and Power BI (more specifically for the M language) that I point out in this video. But don't worry! I do show one way around it within the video as well.
In the Visualization Pane
While I'll admit that I like the R language visual options (especially with the ggplot2 library) more than the options in Python, there are some great ways to use Python to create visuals that otherwise wouldn't be possible in Power BI. One example of this is a dendrogram. I use this tree-like heatmap visual to visualize the outcome of the hierarchical clustering algorithm in another one of my earlier Power BI Weekly videos.
Here's what this data visualization actually looks like in the example for this video. It's one of my favorites! There's something about the combination of the color gradient on the rectangles and the lines that show how closely related these rectangles are that makes it an especially impactful visual.
领英推荐
Supported Libraries
While the use of Python can increase our Power BI capabilities, it's also important to note its limitations. There are specific Python packages/modules/libraries that the Power BI service explicitly supports. That's not to say that others won't run when we run Python scripts in Power BI (especially for Power BI Desktop, which runs on the Python version we install on our own computer). But rather that these are the ones supported in the Power BI service when we upload our models.
For those wondering, I use pandas probably more than any other library, regardless of whether it's supported or not in Python (thankfully it is). I use scikit-learn (also known as sklearn) quite a bit as well to run algorithms on the data, especially once I create a useful pandas DataFrame object. For visualizations, I use matplotlib a bit, but I like the way the output appears from seaborn more. The thing is though, that seaborn is a wrapper that goes around matplotlib as well. Power BI requires us to install both the pandas and matplotlib libraries for Python to run within the application.
The options for R came out before Python within Power BI, which is perhaps why there are over 900 R libraries officially supported in the Power BI service, compared to only 8 for Python. If I were to describe my own learning process for the Python language specifically, it would look approximately like the steps below. There isn't only one way to learn skills or a language like this either. Even one single person can take many potentially different paths to learn the same skill!
More Algorithms
Python isn't the only programming language that I use a lot. The project at hand is the most common determinant of what tool (or tools) I use at any given point in time. But Python is one of my favorite tools to use either way!
Once I learned one programming language, it was much easier to pick up other languages because there's a lot of overlap between them both from the high-level concepts to the way of thinking about how to approach solving a problem. It's interesting how people that come from different backgrounds approach programming because what's easy for one person may be hard for someone else and there's nothing wrong with that either. Knowing how to use algorithms in Python is what makes it (and any other programming language) exciting to use. Here's a course that I love on algorithms in programming (not just Python) from fellow LinkedIn Learning instructor Joe Marini!
Coming Up
I'm excited to share that I'm currently working on a time series course for the LinkedIn Learning library. I'm looking forward to sharing more about this course when it comes out as well as future Power BI Weekly videos. Please subscribe to this newsletter to learn more! And keep learning! I'm always learning something new myself too!
-HW
Optimization Architect @ CAMS | Empowering Data-Driven Decision-Making
1 年Ernesto Orellana ??
Data Discovery Senior Analyst @ Mars Petcare | MCT
1 年It gets even more interesting when the user is asked to install anaconda to learn more about python. lol.
Manager, Field Support Analytics | Data Analysis | Modeling | Forecasting | Business Insights
1 年Very cute Helen Wall
@METRO | Business Intelligence | Python | SQL | PowerBI
1 年When the user will install anaconda, they will have a snake family!
The Space Data Guy ???
1 年Imagine if that person saw a similar message for R. “It’s telling me to find a pirate to run the program.”