How to use Pandas DataFrame
• 1 minPandas is today one of the leader in the Data Science industry due to its state of the art Python data manipulation toolkit.
DataFrames are at the core of the Pandas library.
A DataFrame can be understood exactly as an excel spreadsheet.
With column and rows.
Installation and Import
First of all, we need to install Pandas using the pip, the python package manager.
pip install pandas
or
pip3 install pandas
import pandas as pd
DataFrame core elements
Each column in a pandas.DataFrame is a pandas.Series.

And when you loop over the DataFrame each row can be understood as a Python dictionary.
How to create a DataFrame
At creation we can either pass a list as index and/or dictionary as data as argument.
The creation of a pandas.DataFrame is quite flexible.
At creation a DataFrame can be empty, with one index, without index but with data, with both an index and data.
# An empty dataframe
df = pd.DataFrame()
# A dataframe with an index only
df = pd.DataFrame(index=range(0,10))
# A dataframe with data only
df = pd.DataFrame(data={"col1": range(0,10)})
# A dataframe with both index and data
df = pd.DataFrame(index=range(0,10), data={"col1": range(0,10)})
The columns data are passed as lists within the data dictionary.
If you want to learn more about DataFrame and how to make the most out of them I wrote a lot of articles that you might find useful.