DEV Community

CBAD
CBAD

Posted on

How to use Pandas

I am writing this post as a cheat sheet for using the python package "Pandas".

Importing Pandas:

import pandas as pd

Reading from a CSV:

dataframe = pd.read_csv('relative_path_to_your_file')

Look at first three rows:

dataframe[:3]

Selecting a column:

dataframe['column name']

Plotting a column by name:

dataframe['column name'].plot()

Plotting all columns:

dataframe.plot()

Conclusion

As you can see, pandas is a very powerful library for working with data sets. It allows us to reformat the data, and chose how we want it to be displayed to gain insights into our datasets.

Top comments (0)