A Tableau Alternative in Python for Data Analysis (in Streamlit & Jupyter) | PyGWalker Tutorial
Summary
TLDRPyGWalker is a Python library that allows users to transform Pandas dataframes into interactive Tableau-like interfaces for data visualization and analysis. Installation is straightforward via pip, and the library can be integrated into Jupyter Notebooks or Streamlit apps. Users can explore datasets by dragging and dropping fields onto axes, apply filters, and switch between chart types. The tool also supports exporting visualizations, dashboard code, and settings, making it a versatile tool for quick exploratory data analysis.
Takeaways
- π¦ Install PyGWalker with 'pip install pygwalker' to integrate it with your Python environment.
- π PyGWalker allows conversion of Pandas dataframes into interactive Tableau-like UIs for data analysis.
- π The library can be used within Jupyter Notebooks or Streamlit apps for data visualization.
- π The 'pyg.walk' function is used to explore dataframes with intuitive drag-and-drop features.
- π¨ Users can choose between dark and light modes for the UI.
- π The data tab provides direct inspection of the dataframe and its entries.
- π The visualization tab enables users to create charts by dragging fields onto x and y axes.
- π§ Resizing and chart type selection can be done through the UI for better customization.
- π Filters and multiple fields can be applied to both axes for in-depth data analysis.
- πΌοΈ Charts can be exported in scalable vector graphic (SVG) format for high-quality images.
- π The 'Export As' feature allows users to save their dashboard configurations as code or a JSON file for reuse.
Q & A
What is the name of the Python library introduced in the transcript?
-The Python library introduced is called PyGWalker.
How can you install PyGWalker?
-You can install PyGWalker by running the command 'pip install pygwalker' in your command prompt or terminal.
What is the primary function of PyGWalker?
-PyGWalker allows users to turn a Pandas dataframe into a Tableau-style User Interface for visual data analysis.
Can PyGWalker be integrated into Jupyter Notebook or Streamlit apps?
-Yes, PyGWalker can be integrated into both Jupyter Notebook and Streamlit apps.
What dataset is used for demonstration in the transcript?
-The 'tips' dataset is used for demonstration purposes in the transcript.
How does PyGWalker categorize data in the visualization tab?
-PyGWalker automatically labels numeric values as measures and the rest as dimensions in the visualization tab.
What types of chart options are available in PyGWalker?
-PyGWalker allows users to choose from different chart types, including bar charts and line charts.
How can you apply filters in PyGWalker?
-Filters can be applied in PyGWalker by dragging the column you want to filter into the filter field and selecting the desired criteria.
Is it possible to export charts created with PyGWalker?
-Yes, charts created with PyGWalker can be exported, for example, to a scalable vector graphic (SVG).
How can you share or replicate the PyGWalker dashboard setup?
-The PyGWalker dashboard setup can be shared or replicated by exporting the configuration as code or as a 'config.json' file.
How does the transcript demonstrate integrating PyGWalker with a Streamlit app?
-The transcript shows that after setting up the Streamlit app with basic configurations and loading the 'tips' dataset, the content from the 'config.json' file can be read to use PyGWalker with the previous settings within the app.
Where can viewers find the Streamlit app and Jupyter Notebook demonstrated in the transcript?
-The Streamlit app and Jupyter Notebook will be uploaded to the presenter's GitHub repo, with the link provided in the description box of the video.
Outlines
π Introduction to PyGWalker
This paragraph introduces PyGWalker, a new Python library that enables users to convert Pandas dataframes into interactive Tableau-style user interfaces for data visualization and analysis. It mentions the ease of installation via pip and the ability to integrate with Jupyter Notebook or Streamlit apps. The paragraph also provides a brief overview of the 'tips' dataset used for demonstration and explains how to use PyGWalker to explore the dataset with its intuitive interface.
Mindmap
Please replace the link and try again.
Keywords
π‘PyGWalker
π‘Pandas
π‘Jupyter Notebook
π‘Streamlit
π‘Dataframe
π‘Visualization
π‘Dark Mode
π‘Export
π‘Filter
π‘Exploratory Data Analysis (EDA)
π‘Config File
Highlights
Introduction of a new Python library called PyGWalker for data visualization.
PyGWalker allows conversion of Pandas dataframes into Tableau-style User Interfaces.
The library can be integrated into Jupyter Notebook or Streamlit apps.
Installation is straightforward via pip: 'pip install pygwalker'.
After installation, PyGWalker can be imported along with pandas.
The 'tips' dataset is used as an example to demonstrate the library's functionality.
PyGWalker automatically labels numeric values as measures and non-numeric as dimensions.
Users can drag and drop fields into x and y axes for data visualization.
The library supports multiple chart types, including bar charts and line charts.
Additional fields can be explored by dragging them into the y-axis for further analysis.
Filters can be applied by dragging specific columns into the filter field.
Charts can be exported in various formats, such as scalable vector graphics.
PyGWalker allows for the addition of multiple charts in a Jupyter Notebook.
The library's functionality can be integrated into a Streamlit app for interactive data analysis.
Config files can be used to maintain settings and dashboard specifications.
PyGWalker's code can be exported and reused for consistent dashboard generation.
The video includes a demonstration of creating a Streamlit app with PyGWalker integrated.
The Streamlit app allows for direct interaction with the data visualization within Streamlit.
The presenter plans to upload the Streamlit app and Jupyter Notebook to GitHub for viewers.
PyGWalker is highlighted as a valuable tool for quick exploratory data analysis.
Transcripts
Hey guys, There's a new Python library called PyGWalker,
which lets you turn your Pandas dataframe into a Tableau-style User Interface for visual
analysis.
You can integrate it into your Jupyter Notebook or Streamlit app.
Let me show you how to use it.
First things first, you need to install it.
Just run "pip install pygwalker" in your command prompt or terminal, and you're all set.
Once that's done, you can import it together with pandas.
Next, for demo purposes, let's load the 'tips' dataset, which looks like this.
Here, we can see the total bill amount, along with the tips, gender, whether the customer
was a smoker or not, the day and time of the visit, and the size.
Alright, now let's assume you want to explore this dataset.
Instead of plotting it in different ways, you can simply call "pyg.walk" and pass in
your dataframe.
You could also specify if you want to use a dark or light mode.
After executing this line, you'll get this canvas with two tabs.
Let me first switch to the data tab.
Here, you can inspect your dataframe and check out some entries if you'd like.
You'll also notice that PyGWalker automatically labels the numeric values as measures and
the rest as dimensions.
Now, let's switch back to the visualization tab.
Like in Tableau, you can now drag and drop the available fields into the x and y axes.
So, for example, let me plot the total bill amount by day.
To resize the graph, you can click here and choose the fixed layout mode.
Now you can resize the chart.
By default, PyGWalker picks a chart type for you.
However, you can use other chart types, like a line chart.
But for our analysis, I'll switch back to the bar chart.
The cool thing is, you can drag additional fields into your chart to explore your data
in a very intuitive way.
So, for example, I'll add the tips to the y-axis.
And instead of the total sum, I might want to look at the average bill amount.
If you want to remove a field, you can simply drag it back to the field list.
Likewise, you can add multiple fields to the x-axis.
Let's say, I'm interested to see if smokers spend more money, and I want to see it for
each day.
Additionally, I also want the information if it was during dinner or lunchtime.
To do that, you can use the colour field.
And I'm only interested in this result for male customers.
So you can apply a filter by dragging the column into the filter field.
Now, I'll select only 'male' and confirm my selection.
The values will then be filtered accordingly.
And to remove it, you can either select all again or simply drag it out of the filter
field.
I think it's a very interesting tool for quick exploratory data analysis.
However, you can also export the charts.
So, for example, I'll export it to a scalable vector graphic, and this is what it looks
like.
Alright, now back in my Jupyter Notebook, you can add additional charts by clicking
up here.
And now you have a second canvas, where you can again explore your data.
There are actually a couple more options in PyGWalker, but I would encourage you to play
around with it yourself.
But one important feature is to export your code.
So, if you click the "Export As" button, you'll have different options.
First, let me export it as "code".
Next, I'll hit the 'Copy to Clipboard' button.
Now, if I paste it into a new cell, you'll see the spec of my dashboard.
If I run "pyg.walk" and specify my specs, we'll get back the same dashboard.
Alternatively, you could also export your settings as a file.
If you do so, you'll get a "config.json".
Let me grab this config file from my downloads folder and paste it into my current directory.
Now, if you want, you can also implement the PyGWalker dashboard into your Streamlit app.
To demonstrate this, I've created the following app.
After importing Streamlit, I'll set some basic page configurations.
Next, I'll load our 'tips' dataset and set up a title and subheader.
The interesting part is here.
We can now read the content from the config file and use "pyg.walk" again in our Streamlit
app, together with the previous settings.
All you need to do is specify "Streamlit" in the environment.
This time, I'll also switch it to the dark mode.
Ok, and with that in place, let's spin up my app by running "streamlit run app.py".
Once my page is loaded, we'll have the PyGWalker canvas in our Streamlit app.
And as before, you can now play around with your data directly in Streamlit.
Ok, guys, and that's all I have for you today.
I will upload this Streamlit app and also the Jupyter Notebook to my GitHub repo.
You will find the link in the description box of this video.
As always, thanks for watching, and I'll see you in the next video!
5.0 / 5 (0 votes)
HIOKI PQ ONE Software - For Analysing Measurement Data from HIOKI Power Quality Analyzers
Angular Material Tutorial - 30 - Data table Sorting
Abstraction Can Make Your Code Worse
Windows 11: Now with More Ads!
Itβs Been a Good Run, Phone Providers.
Mind-bending new programming language for GPUs just dropped...