convert/python - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Conversion : convert/python

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

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.

See Also

convert

Python

type/python