Before working with pandas, we must ensure the correct version is installed on our system. We can check if the correct pandas version is installed using the following ways.
Use the pip show
command
Use the __version__
attribute
pip show
commandLet's look at how to check the currently installed version of pandas using the pip show
command.
Install the pandas library using the pip3 install pandas
command.
Use the pip show pandas
command to get information about the pandas package, including the version.
__version__
attributeLet's look at how to check the currently installed version of pandas using the __version__
attribute.
As we have already installed the pandas, we now execute the python3
command to enter the Python environment.
Import the pandas library using the import pandas as pd
command.
Print the __version__
attribute of the pandas using the print(pd.__version__)
command to check the currently installed version of pandas.
Execute the exit()
command to exit the Python environment.
Run any of the methods listed above in the terminal below to check the installed pandas version.
Note: We have already installed Python in the terminal below. Execute the command
python3 --version
to check the Python version.
We have discussed two methods to check the pandas version. Using any of these methods, we can easily check and ensure that we have installed the system's correct version of the pandas.
Free Resources