Python pandas узнать версию

How To Find The Installed Pandas Version in python

A DataFrame is the primary data structure of the Pandas library in Python and is commonly used for storing and working with tabular data.

A common operation that could be performed using Pandas is to find its installed version on our system to make debugging and referring documentation easier.

To start working with Pandas, we first need to import it:

Now, let’s say we need to find the installed version of Pandas on our system. The resulting output would look like this (output depends on your version of pandas) :

Читайте также:  Java for new syntax

Let us look at different ways of performing this operation on a given DataFrame:

Find Pandas Version using the pd.__version__ property in Python

In this method, we use the pd.__version__ property to find the installed version of pandas on our system.

The returned value is stored in a variable named ver and this value is later printed.

In this example, the version was 1.3.5 which is seen in the output but this might change based on the version of pandas currently installed on your system.

Let us take a look at the corresponding code snippet and generated output for this method:

# Importing pandas import pandas as pd # Getting the version ver = pd.__version__ # Printing the version print(ver)

Find Pandas version using the pip command

In this method, we use the pip command to find the installed version of pandas on our system.

This command needs to be run in the command prompt.

We use pip list to list all the libraries currently installed and then use the piping | operator with the grep command to filter out the pandas library.

In this example, the version was 1.3.5 which is seen in the output but this might change based on the version of pandas currently installed on your system.

Let us take a look at the corresponding code snippet and generated output for this method:

Find Pandas Version using the pd.show_versions() function

In this method, we use the pd.show_versions() function to find the installed version of pandas on our system.

We pass the parameter as_json as False in this example.

In this example, the version was 1.3.5 which is seen in the output but this might change based on the version of pandas currently installed on your system.

Along with the version of pandas, we get the versions of other dependencies as well.

Let us take a look at the corresponding code snippet and generated output for this method:

# Importing pandas import pandas as pd # Printing version pd.show_versions(as_json = False)

Conclusion

In this topic, we have learned to find the installed version of Pandas DataFrame on our system. Feel free to reach out to info.javaexercise@gmail.com in case of any suggestions.

Источник

Python 3: Как узнать версию библиотеки Pandas, Numpy

Вариант 1. Узнаем версию библиотеки в скрипте Python

Для того, чтобы узнать версию библиотеки, необходимо вбить следующую команду (например для Pandas):

import pandas as pd print (pd.__version__)

Пример для Numpy:

import numpy as np print (np.__version__)

Вариант 2. Проверить с помощью pip менеджера пакетов

С помощью менеджера пакетов pip можно проверить версию установленных библиотек, для этого используются команды:

pip list

Выведет список установленных пакетов, включая редактируемые.

pip freeze

Выводит установленные пакеты, которые ВЫ установили с помощью команды pip (или pipenv при ее использовании) в формате требований.

Вы можете запустить: pip freeze > requirements.txt на одной машине, а затем на другой машине (в чистой среде) произвести инсталляцию пакетов: pip install -r requirements.txt .

Таким образом вы получите идентичную среду с точно такими же установленными зависимостями, как и в исходной среде, в которой вы сгенерировал файл requirements.txt.

pip show

Выводит информацию об одном или нескольких установленных пакетах.

Anaconda — conda list

Если вы используете Anaconda, то вы можете проверить список установленных пакетов в активной среде с помощью команды conda list .

Источник

How to Check Pandas Version ( Jupyter, Colab, Terminal, Anaconda, Pycharm)

Pandas is a python module that allows you to create a dataframe and easily manipulate it using the various inbuilt pandas function. If you want to know which version of pandas module is installed in your system, then this post is for you. Here you will learn the various ways to check the pandas version on different platforms.

How to check pandas version on different platforms

Terminal or Command Prompt

Open your terminal type the python to run the Python console and then run the below lines of code to get the pandas version in your system.

>>import pandas as pd >>pd.__version__

You will get the pandas version.

Checking pandas version on terminal

Jupyter notebook

Type the following lines of code to check the version of pandas in Jupyter Notebook

Checking pandas version on jupyter notebook

Pycharm

You can check the version of the pandas in the project interpreter. Go to File > Settings > Project Interpreter. There you will see all the list of python packages in your python environment. You will find the pandas module with the version there.

Anaconda

If you want to check the pandas version using conda then open the anaconda prompt and type the following command.

Checking pandas version on anaconda prompt

Google Colab

You can use the pipe freeze command to know the version of the pandas installed in the Google colab. Rune the below command in the code cell to get the version.

pandas==1.3.5 pandas-datareader==0.9.0 pandas-gbq==0.13.3 pandas-profiling==1.4.1 sklearn-pandas==1.8.0

These are the ways to check the version of the pandas on different platforms. If you have any suggestions then you contact us to add more ways here.

Источник

How to Check Pandas Version?

One can check pandas version on the Linux server, Windows system, and Mac OS by running pip commands either from the command line or by running a statement from a Python program. You can pretty much run these commands on any system where the pip package is installed.

In this article, I will covert getting pandas package version by using shell command or from programmatically. Install the latest pandas version on windows if you don’t have it.

1. Check pandas Version from Command or Shell mode

From a command line or shell run the pip list command to check the pandas version or get the list of the package installed with the currently installed version next to the package. If you don’t have pandas installed then this command doesn’t list it. I have a pip3 installed so I am using pip3 to find out the pandas version installed.

Check Pandas Version

My installed version of pandas is 1.3.1 hence it shows on the list.

2. Check pandas Version from Programatically

Sometimes you may need to know the pandas version programmatically at runtime in order to make a decision and take different paths based on the version installed.

In order to check the pandas version programmatically, first, you need to import pandas and use pd.__version__ attribute.

3. Find All pandas Version and it’s Dependency Package Versions

Pandas package has a lot of other package dependencies and you can get these by running the pd.show_version() method of pandas.

This returns a list of pandas dependencies and their versions.

Get Pandas Version Dependencies

4. Other Alternate Ways to Get Current Installed Version

Below are other alternative ways to get version from windows command and Linux shell/Mac OS terminal. In order to use conda you need to have Anaconda distribution installed on your system.

On Linux/Mac OS: You can use these on Linux or Mac OS to find Version.

Conclusion

Here you have learned different ways to get or find pandas installed versions. You can use these on Linux, Windows, Mac, or any other OS that supports Python, pip, and Anaconda. You have also learned to get the version programmatically using __version__ attribute and show_versions() method.

References

You may also like reading:

Источник

How to Check Pandas Version in Your Python Script?

Check Pandas Version: This article will explain you how to get the version of pandas directly in a python code or with the package installer called pip.

What is the Pandas Library?

Pandas is a Python library primarily used for data analysis. It is very popular and has a very active community of contributors. Pandas is essentially based on two Python libraries: Matplotlib for data visualization and NumPy for mathematical operations. It is a kind of overlay of these two libraries.

Pandas introduced two new types of objects for data storage that facilitate analytical tasks: Series, which have a list-like structure, and data frames, which have a tabular structure.

Many versions are deployed each year and at times it will be necessary to know the exact version of your installed Pandas library (to avoid certain conflicts for example).

There are several methods to check the version of python of which here are the most used:

  • The pandas pd.show_versions() function
  • __version__ attribute
  • Check Your Pandas Version with Pip

In the following we will detail these 3 methods.

Check Pandas Version Using __version__ attribute

Like most python packages, you can get the version number of pandas with the version attribute.

The first step is to import the pandas library and then use the print() function combined with the version attribute:

# __version__ import pandas as pd print(pd.__version__)

Check Pandas Version With The Dependencies: pd.show_versions()

The pandas.show_versions() function allows to generate detailed information like Python versions, dependent packages and operating system type.

# show_versions() import pandas as pd print(pd.show_versions())
INSTALLED VERSIONS ------------------ commit : 5e238bf1706dd712ed32dda23e52b python : 3.7.6.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19041 machine : AMD64 processor : Intel64 Family 6 Model 158 Stepping 12, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : None.None pandas : 1.3.2 numpy : 1.21.2 pytz : 2021.1 dateutil : 2.8.2 pip : 19.0.3 setuptools : 40.8.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None

How to Check Your Pandas Version with Pip?

With pip, it is also possible to get your Pandas version. This works equally well with the Windows command prompt, Powershell, Linux shell or MacOS terminal.

Here is an example with the Windows command prompt :

(venv) C:\Users\amiradata\Projects\>pip show pandas Name: pandas Version: 1.3.2 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Author: The Pandas Development Team Author-email: pandas-dev@python.org License: BSD-3-Clause Location: c:\users\ayed7\pycharmprojects\sharepoint\venv\lib\site-packages Requires: pytz, python-dateutil, numpy Required-by:

Conclusion

This tutorial describes the different methods to check the version of pandas. These methods are easy to use.

If you want to know the latest version of pandas released, you can consult this link:

I also wrote a tutorial to install a specific version of a library: pip install specific version.

I’m a data scientist. Passionate about new technologies and programming I created this website mainly for people who want to learn more about data science and programming 🙂

Источник

Оцените статью