Close
Close window
python - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

convert/python

convert to Python expression

Calling Sequence

convert(expr, python)

Parameters

expr

-

expression to convert

Description

The convert(expr, python) command accepts a Maple expression and returns a result suitable to use as input for Python[EvalFunction] .

In this conversion, numeric literals and strings are left as is, and container structures such as tables and Arrays are replaced with references to equivalent Python structures.

Conversion of the following types is supported:

Examples

The convert command leaves this list unchanged as it can already be used with EvalFunction.

>

convert1,5,7,python

1,5,7

(1)
>

Python:-EvalFunctionlen,1,5,7

3

(2)

This Vector is converted to an equivalent ndarray (NumPy n-dimensional array).

>

pvconvert1,5,7,python

pv<Python object: [1 5 7]>

(3)
>

typepv&comma;python

true

(4)

This table is converted to a Python dictionary.

>

Ttabledog=canine&comma;cat=feline

Ttablecat=feline&comma;dog=canine

(5)
>

pdconvertT&comma;python

pd<Python object: {'cat': 'feline', 'dog': 'canine'}>

(6)
>

typepd&comma;python

true

(7)

Compatibility

The convert/python command was introduced in Maple 2020.

For more information on Maple 2020 changes, see Updates in Maple 2020 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /