Installing Pandas
To install pandas, you need a Python environment. Before starting, we assume you have already installed Python and Pip.
Install pandas using pip:
pip install pandas
After successful installation, you can import the pandas package:
import pandas
Example - Checking pandas Version
>>> import pandas
>>> pandas.__version__ # Check version
'1.1.5'
Typically, pandas is imported using the alias pd
:
import pandas as pd
Example - Checking pandas Version
>>> import pandas as pd
>>> pd.__version__ # Check version
'1.1.5'
A simple pandas example:
Example
import pandas as pd
mydataset = {
'sites': ["Google", "tutorialpro", "Wiki"],
'number': [1, 2, 3]
}
myvar = pd.DataFrame(mydataset)
print(myvar)
Executing the above code will produce the following output: