Experimental Work With Python’s pandas & matplotlib

Hi there. I wanted to display some experimental work that I have been doing with Python and the packages pandas and matplotlib.



Setup & Loading In Sample Real Estate Data

The first lines of code involve importing the appropriate packages into Python.

For this section and the next section, we work with sample real estate data.


Some Functions in pandas

In this section, I work with a few functions from the pandas package.

Printing Rows:

Selecting Columns:

Selecting Rows & Columns

Rows and columns can be selected with the use of .iloc. The user can specify the rows and columns he/she wants.

Favourite Colours Sample Data With pandas & Matplotlib

For this section, I create fake sample data on people’s favourtie colours in pandas.

Since I want to create a sorted horizontal bar graph in Python, I sort the data.

For the bar graph, I wanted the bars to be horizontal, sorted and also have the colours match the responses. I have included references to where I have found pieces for this code.

Leave a Reply