Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to make a data chart!

Hello everyone!

Here is tutorial about how to make a simple data chart using pandas.


First, you need to know what the data charts you will do(like OS market share, iOS version popularity,etc.), in this post, I will make the data chart of the OS market share.

2.Install the data chart

1.Open a new tab on your browser and search for <Thing> market share, when <Thing> is the thing(like software, hardware,etc.) you like.
2.Then, choose a random website, and when click on that website, you should see a data chart and some other things for decoration and edit the data chart.

3.Next, you will see a button that help you to edit the chart, this depends on the website. When you click on that, you will some settings(like Chart Type, Period, Regions,etc.). For the chart type, I recommend you to choose Bar as the chart type.

5.Finally, when you are done settings for the data chart, you will see a button that help you to install the chart as .csv file, click on that.

6.When the file is installed, open your OS's file manager, then click on Downloads and you will see the data chart file.

7.(Optional) Rename the file to make it easier to remember.

3.Prepare the project

Now, we are done for the data chart, let's prepare the project!
1.Create a new repl project(Or a new project if you are using a text editor or an IDE), then choose programming language as Python.

2.Then, click on Package button on your IDE or text editor or repl project.

3.Now, search pandas and click on the first one.

4.Click on the + button in repl(Or Install if you are using text editor or IDE), because I have install pandas before so you will see the - button.

5.When pandas is installed, upload the file, with repl, click on the next to the Add Folder button.
6.Now, click on the Upload File and choose the data chart file we have installed before.

7.If you are using a text editor or an IDE, just move the data chart file to the project folder.


Now, it's time for code! This is the easiest part when you just need to type 3 Python codes and you will finished the program.
1.Type this command to import the pandas package as pd:
immport pandas as pd
2.Then, type:
DataChart = pd.read_csv("OSMarketShare.csv")
In the code, DataChart will contains the content of the data chart file(which is OSMarketShare.csv because I renamed it).
3.Finally, type:
The code will print the DataChart var which contains the content of the data chart file.
4.This is all the code in the program:

5.Now, run the program and you should see the output somewhat like this(sorry for the pic is kinda sucks):

And that's the end of this tutorial! Upvote it if you like it! :D

Have any problem or like it or want to give me a suggest? Just comment down below!

EDIT:The try, except code is optional, you can add it or not.


Thanks for this tutorial. Very well explained.