When using panda for data processing, some functions may be obsolete in some versions. To solve this problem, you need to know the version number in the current environment. How to check the version number of pandas?
Use version Variable
In pandas, there is a version variable that directly records the current version number.
Run the following code and output the version number. In my environment, the version of pandas is: 0.24.2
1 | import pandas as pd |
Use show_versions function
The show_versions function in pandas can display the version numbers of pandas and related dependent libraries. The code is as follows:
1 | import pandas as pd |
Will output something similar to the following:
1 | INSTALLED VERSIONS |
Use pip list
If you use pip as a package management tool, you can also use the pip list command, which will output the names and version numbers of all packages in the current environment.
Of course, if you are using a Unix-like system, you can also use grep to control the output for easy viewing, such as:
1 | pip list | grep pandas |