Introduction to PandasΒΆ
Pandas is one of the most popular choices to load, visualize, clean, and apply statistical techniques to data. It is specially useful in Jupyter Notebooks as it lends itself to iterative exploration with cells.
InstallationΒΆ
As always, use a virtual environment (or similar) to install pandas and its dependencies:
$ python3 -m venv venv
$ source venv/bin/activate
The example above should work for Linux and OSX, but there is support for Windows systems as well. Follow the documentation if you need help.
The package to install is pandas
!pip install pandas
Common operations in PandasΒΆ
After installing, you will almost always see Pandas imported with an alias. This an other common practices in pandas are covered in this section.
import pandas as pd
#list of lists
data = [[4, 2, 1],
[3, 0, 1],
[1, 0, 0]]
columns = ['apples', 'bananas', 'oranges']
index = ['Monday', 'Tuesday', 'Wednesday']
df = pd.DataFrame(data, index, columns)
print(df)