Make a bar-chart from a CSV in Python CSV bar plot bar chart using a CSV

Test Case was implemented in Python 3.6.5 running on a Ubuntu Linux 18.04 64-bit virtual machine. In order to carry out this test-case you will need to create an account in and create the credentials file on the host you will be running Python from. All instructions are on their web site

Step 1:
Suppose a CSV which has a first row we want to define as the X-Axis of our plot, and two further rows which we want as the data in the Y-Axis. It could be something like this:

~$ cat /home/nikolas/categories.csv
SciFi-Fantasy , 31.550787 , 68.449219
Spirituality , 83.411890 , 16.588112
Home-Improvement , 47.082787 , 52.917217
Gaming , 2.256584 , 97.743423
Mountain-Bike-Touring , 40.905171 , 59.094826
Korean-Culture , 71.040140 , 28.959862
Health-Safety , 32.872467 , 67.127533
Religion , 37.452973 , 62.547028
Fashion , 98.597282 , 1.402729

Step 2:
Load the CSV into a data frame using library Pandas using function read_csv and display the data of each row, using function iloc:

Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> mycatg=pd.read_csv('/home/nikolas/categories.csv',sep=',',header=None)
>>> mycatg.iloc[:,0]
0 SciFi-Fantasy
1 Spirituality
2 Home-Improvement
3 Gaming
4 Mountain-Bike-Touring
5 Korean-Culture
6 Health-Safety
7 Religion
8 Fashion
Name: 0, dtype: object
>>> mycatg.iloc[:,1]
0 31.550787
1 83.411890
2 47.082787
3 2.256584
4 40.905171
5 71.040140
6 32.872467
7 37.452973
8 98.597282
Name: 1, dtype: float64
>>> mycatg.iloc[:,2]
0 68.449219
1 16.588112
2 52.917217
3 97.743423
4 59.094826
5 28.959862
6 67.127533
7 62.547028
8 1.402729
Name: 2, dtype: float64

Step 3:

Include the libraries

import plotly.plotly as py
import plotly.graph_objs as go

then define the axis data, using the above way to address the rows in the data frame. so:

yaxis1 = go.Bar(
name='Category A'
yaxis2 = go.Bar(
name='Category B'

data = [yaxis1, yaxis2]
layout = go.Layout(

then perform the plot itself.

fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='barplot in,')

Step 4:

This is it. The plot is created as a SVG file in In this case the graph was created here:


How to install a Linux Virtual Machine


You need two pieces of software to have Linux machine going under your laptop: The virtualization software, and an image of the operating system you plan to stage in your Virtual Machine (VM). Trying to keep this article as short as possible, any issues with hardware requirements and licensing for production use are left outside.

Step 1

Identify the combination of virtualization software and Linux platform you need. This demo will install Oracle VM VirtualBox and deploy UBUNTU 18.04 64 bit, on a laptop running Windows 10 Home

Step 2

Download the VirtualBox binaries here:

VirtualBox Download
Select your platform (“Windows hosts” in our case), choose Save, let it download and then run the executable.
Oracle VM installation
Go through the installation steps. As a start, you can leave everything default. Keep disk space in mind

Download the LINUX distribution:

Download the Linux release
Review the release notes, and observe the system requirements. Since you will running the OS as a VM, all requirements add to the requirements of your host operating system and your virtualization software
Ubuntu Desktop download
Choose to save the file. Ideally, keep its download path simple (ie c:\VMs\UBU1804). Avoid long paths or complicated names

Once done, it is time to launch the VirtualBox and create the virtual machine. Find the “Oracle VM VirtualBox” icon on your desktop or program group. It looks like this:

Double click to launch

When it has launched, click on the left-most icon in the toolbar (“New”) then provide a name for your VM, the type and the version. This should much the Linux distro you have downloaded.

Creating the VM
type a name of your choice, then put in Type and Version lists the version you have already downloaded
Memory selection
This entry should match the requirements of the distro (see above) but also the capacity of your machine.

In the next three pages of the install process you need to create a Virtual Hard Disk. The simplest choice is to select VHD (Virtual Hard Disk)/Fixed size. The distro notes should point to a minimum disk requirement (see above screenshot)

Minimum disk should be the requirement of the Linux distribution of choice, or larger
…this might take so time, be patient!
When this is finished, you will see your newly created machine in the list. Click on the green “Start” button to launch it for the first time

…The first time you launch your VM, it will ask
for a start-up disk. This will be the Linux distribution file that we downloaded:

The start-up disk for your Linux Virtual Machine is the distribution you have already downloaded. Notice the .ISO extension of the file

From then on, there will be a Welcome dialogue (similar to any startup installation such those that come in smartphones).

When running this dialogue within the Oracle VirtualBox, the “Try Ubuntu” option allows you to keep using the .ISO file, the “Install Ubuntu” option will use the Virtual Hard Disk we created previously and install the operating system there. In both cases, our laptop’s existing OS will not be affected
Ready VM
The result of your effort: a fully functional LINUX machine, with Internet access and device connectivity (USB headsets, mouse) just as your “real” laptop