python - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


convert/python

convert to Python expression

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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:

Array

complex(extended_numeric)

DataSeries

list

Matrix

set

string

table

Vector

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

Ttabledog=canine&comma;cat=feline

(5)

pdconvertT&comma;python

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

(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.

See Also

convert

Python

type/python