How to make a bar chart race with python (30 lines of code + example scripts)

  Рет қаралды 7,520

Sjoerd Tilmans

Sjoerd Tilmans

Күн бұрын

Пікірлер: 87
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Please post any questions you might have in the comments of this video. I will try to keep an eye on the comment section to help out.
@aryamanisha9763
@aryamanisha9763 Жыл бұрын
Sir showing error no image found... Or tclError
@aryamanisha9763
@aryamanisha9763 Жыл бұрын
I'm using this code in jupyter lab
@PieChartPirate
@PieChartPirate Жыл бұрын
@@aryamanisha9763 are you on Windows or Mac?
@nivekg992
@nivekg992 2 жыл бұрын
This is awesome, thank you so much for deciding to continue these tutorials.
@redforestx7371
@redforestx7371 Жыл бұрын
Using this right now. Dude, you're the man!!! Will definately give you a shoutout everytime I use it
@alexmacedo9345
@alexmacedo9345 Жыл бұрын
This is sooo good that I decided to buy you a coffee, Sjoerd! Nice job on this one! I wonder how to show more than 10 bars at the same time as I have more than 10.
@aryamanisha9763
@aryamanisha9763 Жыл бұрын
I want to learn more data analysis... Please make more video on it sir❤
@PieChartPirate
@PieChartPirate Жыл бұрын
Thank you! More are coming!
@baturalpuygun
@baturalpuygun 3 ай бұрын
Hello, First of all, thank you very much, excellent content! How can I remove the "MADE WITH SJVISUALER" text at the bottom right?
@PieChartPirate
@PieChartPirate 3 ай бұрын
You can remove it if you dive deep in the code. But as it is a free tool I appreciate it if you leave it in :)
@AlienArtCharts
@AlienArtCharts 2 жыл бұрын
Nice tutorial, thank you!
@1südtiroltechnik
@1südtiroltechnik 2 жыл бұрын
Thank you, Danke! I didnt think anyone would share how this works.
@FightWeekShowcase
@FightWeekShowcase Ай бұрын
Gamechanger! Thank-you!
@theodorthisell4444
@theodorthisell4444 2 жыл бұрын
Thank you very much for this! It would also help me tremendously if you could show how you add an animated map to the visualization.
@gabriellourenco3643
@gabriellourenco3643 Жыл бұрын
is it possible change the comma for dot? I do know where I should do it in the code...
@PieChartPirate
@PieChartPirate Жыл бұрын
Not from the main script. You can take a deep dive in the code to find where values are formatted.
@huseyinalbayrakdata
@huseyinalbayrakdata 2 жыл бұрын
Thank you so much you are great!! Do you know how we can export as a video
@huseyinalbayrakdata
@huseyinalbayrakdata 2 жыл бұрын
Also how we can move time from right to left side of canvas
@PieChartPirate
@PieChartPirate 2 жыл бұрын
To convert it to a video I would record your screen. I use OBS studio for that. It is free and open source
@IbteeDApunisher
@IbteeDApunisher Жыл бұрын
I want to show more than 10 bars at the same time as I have 25 options. Even if they get outnumbered and disappear, that is fine but at least they should appear once. Is that possible?
@zechariaparas9885
@zechariaparas9885 Жыл бұрын
Awesome tutorial video. Just wanted to ask one thing. When the graph gets to the end, the X-AXIS markers gets lost.
@hamidrezamohamadi9052
@hamidrezamohamadi9052 2 жыл бұрын
Thank you for sharing. it was so cool.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Can't wait to see what people make with it
@hamidrezamohamadi9052
@hamidrezamohamadi9052 2 жыл бұрын
@@PieChartPirate can u please explain how the excel file should be?
@PieChartPirate
@PieChartPirate 2 жыл бұрын
@@hamidrezamohamadi9052 first column should be dates or just years. The subsequent columns should be the data categories. There are some issues with excel files start with empty cells. Please make sure all data cells are filled
@na_at_worlds
@na_at_worlds Жыл бұрын
Hey, great tutorial, thank you. Quick question, is there any way to remove decimal points from the data? I'm working with data which contains only whole numbers and my visulisation is showing the data with 2 decimal points. I just wanted to know if there is a way to remove these.
@AFACT2M
@AFACT2M 9 ай бұрын
Can you tell which software use vgraphs KZbin channel
@visual.information
@visual.information Жыл бұрын
Thank you very much!
@akwanzambitionz
@akwanzambitionz Жыл бұрын
Hello thank you for this! Though, do you know how to move the time indicator? I don't want it to stay at the bottom left corner if that is possible!
@Orcas220
@Orcas220 Жыл бұрын
Hi Sjoerd, thanks for this end to end tutorial. Do you know a way to export the canvas as an mp4 video like the bar_chart_race using ffmpeg?
@jamestsv7264
@jamestsv7264 Жыл бұрын
ModuleNotFoundError: No module named ‘sjvisualizer’ And I did it exact like in video Also I can see it in pip list But can’t use it in pycharm 😢
@musashyful
@musashyful Жыл бұрын
@jamestsv7264 same ! did you figure it out ?
@jamestsv7264
@jamestsv7264 Жыл бұрын
@@musashyful no
@altaf1404
@altaf1404 Жыл бұрын
Thanks for sharing. Can you please tell me that how can i make video from that animation using ffmpeg?
@bjornheimdall1519
@bjornheimdall1519 2 жыл бұрын
Excellent work! Is there a way to save the output as video?
@PieChartPirate
@PieChartPirate 2 жыл бұрын
For now it is a matter of recording the screen. Should probably have mentioned that 😅 I use OBS studio. It is free to use.
@Dussellus
@Dussellus 2 жыл бұрын
Oooh this is good!
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Thanks
@rahmountaharzakaria115
@rahmountaharzakaria115 Жыл бұрын
how did you manage to align each picture perfectly with its repective bar , trying to do it since a week but no avail
@Cami355ER
@Cami355ER Жыл бұрын
thanks
@elmehdifahim563
@elmehdifahim563 Жыл бұрын
Thank you for this video, indeed I have a problem how I read a file with a date like this YYYY-MM
@IbteeDApunisher
@IbteeDApunisher Жыл бұрын
Hi, nice visualization. I want to apply it on my data. It is running but it loads into a full screen and then after running the visual, that window freezes up and is difficult to close/ rerun. I am on M1 Mac and I start getting the processing rainbow wheel after that. The kernel dies then on JN and I have to restart to run the visual again. Any advice?
@italiano_quiz
@italiano_quiz Жыл бұрын
Thank you :-)
@bineeshalakkal22
@bineeshalakkal22 Жыл бұрын
How to change the Orientation of the Bar chart to vertical?
@florindragusin2473
@florindragusin2473 2 жыл бұрын
Is this package working only under Windows? Trying to run it on Mac, and I get an error module ‘cytpes’ has no attribute ‘windll’.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Good question. I have never ran it on Mac.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
I will take a quick look to see if I can resolve it
@PieChartPirate
@PieChartPirate 2 жыл бұрын
It should now work with Mac OS.
@florindragusin4449
@florindragusin4449 2 жыл бұрын
@@PieChartPirate I made it :) I put that parameter = 1 in all the files, where that was called , SCALEFACTOR = 1. and worked :). Another small thing was adjusting the code for the flags as for me were not showing up, so on the path of the assets had to change from "assets\\" to "assets/" on the path in BarRace.py and worked with the flags as well on mac. Overall you rock , is a great package.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
@@florindragusin4449 awesome thanks for the feedback. Feel free to do a pull request
@Dussellus
@Dussellus 2 жыл бұрын
Currently trying it out and works perfectly with the nuclear excel file, but when I try to use my own data, i get some errors I'm not entirely sure how come. essentially: traceback errors and a 'IndexError: index 0 is out of bounds for axis 0 with size 0'
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Ok not sure about that one. Do you have empty cells in your data file?
@Dussellus
@Dussellus 2 жыл бұрын
@@PieChartPirate Nope, but I suspect it's because I have a very wide dataset with lots of titles/names. I've scrubbed it clean from special characters and replaced all blanks with 0. If I copy/paste my data to fit with Nuclear wide and height (From A - O and from 1 - 17) it works.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
@@Dussellus Ok it should work with many columns, I use it all the time with 150 or more columns. Maybe there is something wrong with one of your columns.
@Dussellus
@Dussellus 2 жыл бұрын
@@PieChartPirate Yeah, so here's the funky thing. When I copy pasted the data into the nuclear excel file, it worked.
@PieChartPirate
@PieChartPirate 2 жыл бұрын
@@Dussellus could you open an issue on GitHub and attach your file? If it is public data
@vrindasarraf8720
@vrindasarraf8720 2 жыл бұрын
Can someone help me download sjvisualizer ERROR: Could not find a version that satisfies the requirement sjvisualizer (from versions: none) ERROR: No matching distribution found for sjvisualizer
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Download the whl file from the link in the description. Open the command line in the directory where you have stored the whl file and type "pip install sjvisualizer-0.0.2-py3-none-any.whl"
@vrindasarraf8720
@vrindasarraf8720 2 жыл бұрын
@@PieChartPirate line 13, in __init__ self.cache_location = "_pandas_cache/{}{}.xlsx".format(self.excel_file.split(".")[0].split("/")[1], int(self.number_of_frames)) IndexError: list index out of range
@sjoerdtilmans3583
@sjoerdtilmans3583 2 жыл бұрын
@@vrindasarraf8720 could you try placing the excel file in a "data" folder?
@florindragusin4449
@florindragusin4449 2 жыл бұрын
​@@sjoerdtilmans3583 happened to me same at the beginning out of eagerness tried to put things there in the main folder and skip the creation of the folder (than figured out that was the issue and created the folder and worked. Maybe a suggestion for other users to prevent this: either create the data folder automatically (same as the assets), or check if the path of the file does not contains "/" to take it directly from the root, rather than try to split path by "/".
@sjoerdtilmans3583
@sjoerdtilmans3583 2 жыл бұрын
@@florindragusin4449 Good point, will make an update soon hopefully
@StatsHub
@StatsHub 2 жыл бұрын
Can i run in visual code studio ?
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Probably, it is just Python
@sixtysecondsof6858
@sixtysecondsof6858 2 жыл бұрын
How i change informations of xlsx?
@lfastrsx
@lfastrsx Жыл бұрын
Hello, I am unable to install the visualizer on my mac using terminal. This is what I typed in: pip install sjvisualizer-0.0.2-py3-none-any.whl Thanks!
@PieChartPirate
@PieChartPirate Жыл бұрын
Do you have python installed? What happens if you type pip list?
@lfastrsx
@lfastrsx Жыл бұрын
@@PieChartPirate Yes but it's not working. I switched to my PC laptop and got it setup successfully. Thanks!
@Aanfamili
@Aanfamili 2 жыл бұрын
Can the data visualization channel be monetized
@craftyraf
@craftyraf 3 ай бұрын
Great video, thank you! Please remove the music, it's hard for me to focus on what you are saying...
@leshen_show
@leshen_show 2 жыл бұрын
can i save my result as a video?
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Should probably have mentioned that. You can record your screen. I use OBS studio
@leshen_show
@leshen_show 2 жыл бұрын
@@PieChartPirate thx
@steepehare6539
@steepehare6539 6 ай бұрын
How to make a line chart race with python? Thank you
@shriradheradh199
@shriradheradh199 2 жыл бұрын
Only first row output show in graph
@PieChartPirate
@PieChartPirate Жыл бұрын
That is a bit odd. Are you on a Mac or PC?
@KetoPowerZone
@KetoPowerZone Жыл бұрын
Bro.. I want to learn data science. Can u teach me??
@MrSmaq25
@MrSmaq25 2 жыл бұрын
Where do you get the data from?
@PieChartPirate
@PieChartPirate 2 жыл бұрын
Want to make a video about that at some point as well
@MrSmaq25
@MrSmaq25 2 жыл бұрын
@@PieChartPirate looking forward to it
@nhanlehoang4500
@nhanlehoang4500 2 жыл бұрын
Traceback (most recent call last): File "/Users/nhanlehoang/Desktop/python/bar_race_1440p.py", line 1, in from sjvisualizer import DataHandler, Canvas, BarRace, StaticImage File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sjvisualizer/__init__.py", line 1, in from sjvisualizer import BarRace File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sjvisualizer/BarRace.py", line 1, in from sjvisualizer import Canvas as cv File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sjvisualizer/Canvas.py", line 2, in from PIL import Image File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/Image.py", line 100, in from . import _imaging as core ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
@PieChartPirate
@PieChartPirate 2 жыл бұрын
What kind of system are you running this on? It looks like Pillow isn't supported on arm processors. Did you install the correct version of python? For your architecture?
@ibnumuslim
@ibnumuslim Жыл бұрын
Thank you very much.. your nuclear file work as intended.. but i change the file and got this.. can you help me.. Loading cashed data frame _pandas_cache\Sensus1800.xlsx Traceback (most recent call last): File "D:\Download\Test3\bar_race.py", line 15, in canvas.add_sub_plot(bar_chart) File "~\site-packages\sjvisualizer\Canvas.py", line 124, in add_sub_plot sub_plot.set_root(self.tk) File "~\site-packages\sjvisualizer\Canvas.py", line 341, in set_root self.draw(self.start_time) File "~\site-packages\sjvisualizer\BarRace.py", line 142, in draw data = self._get_data_for_frame(time).sort_values(ascending=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "~\site-packages\pandas\util\_decorators.py", line 331, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "~\site-packages\pandas\core\series.py", line 3768, in sort_values sorted_index = nargsort(values_to_sort, kind, bool(ascending), na_position) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "~\site-packages\pandas\core\sorting.py", line 438, in nargsort indexer = non_nan_idx[non_nans.argsort(kind=kind)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'numpy.ndarray' and 'str' Process finished with exit code 1
100 Euro am Tag mit Bar Chart Races verdienen
10:41
Leon Chaudhari
Рет қаралды 2,5 М.
Making Bar Chart Race with Python | Data Science
10:25
Andrés Berejnoi
Рет қаралды 9 М.
отомстил?
00:56
История одного вокалиста
Рет қаралды 5 МЛН
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 58 МЛН
ANIMATE Your Python Graphs with Matplotlib!
24:35
datagy
Рет қаралды 11 М.
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 136 М.
Create email and text message SMS alerts with Python!
9:49
ClarityCoders
Рет қаралды 152 М.
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 563 М.
Automating My Life with Python: The Ultimate Guide | Code With Me
11:26
How to create a bar chart race using Python in 2023
9:34
Sjoerd Tilmans
Рет қаралды 8 М.
How to Convert a Streamlit App to an .EXE Executable
8:20
Fanilo Andrianasolo
Рет қаралды 45 М.
Create Racing Bar Graph - Python Plotly
16:34
Charming Data
Рет қаралды 10 М.
Make A Bar Chart Race Without Using Code | Step By Step
9:51
Tutorian Tutorial
Рет қаралды 5 М.
отомстил?
00:56
История одного вокалиста
Рет қаралды 5 МЛН