Import - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : Import

Import

import external data into Maple

 

Calling Sequence

Parameters

Options

Description

Supported Formats

Examples

Compatibility

Calling Sequence

Import(origin, opts)

Parameters

origin

-

string or ByteArray; file path or URL to a data file or the data itself

opts

-

(optional) the embed, format, or output options as described below

Options

• 

format : string corresponding to one of the supported import formats; if unspecified and source=file, the format is inferred from the file extension of origin.

• 

output : specifies the desired method for representing the imported data.

• 

source : one of file or direct; specifies whether data is read from a file/URL or from memory.

Description

• 

The Import command provides a generic mechanism for importing data in various file formats. The source data can be an external file or URL or a string or ByteArray in the current session.

• 

The form which the imported data takes in Maple is determined by the format (either inferred or specified by the format option) and the output option.

• 

The source option may be set to file or direct. The default, source=file, specifies that the data should be read from the file referenced by origin. In contrast source=direct means that origin is a string or ByteArray which directly contains the data. Note that source=direct requires format to be provided explicitly.

• 

For details on controlling the form of imported data for a particular format, consult the documentation for that format.

Supported Formats

BMP

BYU

CNF

CSV

DGML

DIF

DIMACS

DOT

Excel

FASTA

FASTQ

GenBank

GEXF

GIF

GPX

Graph6

Graphlet

GraphML

GXL

GZIP

INI

JPEG

JSON

JVX

KML

KMZ

LEDA

MathML

MAT

MatrixMarket

MLA

MPL

MPS

MW

OBJ

ODS

OFF

Pajek

PLY

PNG

SHP

Sparse6

STL

SXC

Text

TGF

TIFF

TSV

Text

VTK

XLS

XLSX

XML

XPORT

ZIP

ZLIB

Examples

Import comma-separated tabular data as a DataFrame.

csvFileFileTools:-JoinPathexample/timedata.csv,base=datadir

C:\Program Files\Maple 2016\data\example\timedata.csv

(1)

ImportcsvFile

1234561Mar 06 01:16 3/7/200526.860912411.4143014721071.5058944021070.06482Mar 06 20:12 3/7/200525.756241812.3582296951072.4976144071070.05913Mar 06 20:43 3/7/200525.127064283.0292123161073.3144771841070.09424Mar 07 00:25 3/7/200525.122490952.4968554191072.6560199931070.06375Mar 07 00:44 3/7/200522.759192762.7224987521072.8185900041070.03536Mar 07 00:59 3/7/200522.206311129.8590108321071.0299759981070.04477Mar 08 00:15 3/8/200522.114772988.3336403211078.5792302261070.02958Mar 08 00:16 3/8/200521.412271131.1742728591071.2179988061070.0372.....................

(2)

Import an image in JPEG format from a remote URL.

urlhttp://www.maplesoft.com/data/examples/jpg/fingerprint.jpg

urlhttp://www.maplesoft.com/data/examples/jpg/fingerprint.jpg

(3)

Importurl

1..240 x 1..256 ArrayData Type: float[8]Storage: rectangularOrder: C_order

(4)

Import a cogged gear encoded in Stanford Polygon (PLY) format.

gearFileTools:-JoinPathexample/gear.ply,base=datadir

C:\Program Files\Maple 2016\data\example\gear.ply

(5)

Importgear

Import structured data encoded in the JSON format.

addressFileTools:-JoinPathexample/address.json,base=datadir

C:\Program Files\Maple 2016\data\example\address.json

(6)

Importaddress

tableaddress=tablestreetAddress=615 Kumpf Drive,country=Canada,city=Waterloo,postalCode=N2V 1K8,province=ON,phoneNumbers=tablenumber=+1 (519) 747-2373,type=local,tablenumber=+1 (800) 267-6583,type=tollfree,tablenumber=+1 (519) 747-5284,type=fax,companyName=Maplesoft,founded=1988

(7)

Import map data from a KMZ file and present it as a 2-D plot.

NorthwestEuropeFileTools:-JoinPathexample/EuropeMap.kmz,base=datadir

C:\Program Files\Maple 2016\data\example\EuropeMap.kmz

(8)

ImportNorthwestEurope,view=13..12,46..64,title=Northwest Europe,titlefont=Times,Bold,20

Import data directly from an input string while specifying the CSV format.

CityDataCity,Population Beijing,21500000 Mumbai,12478447 New York,8405837 :

ImportCityData,source=direct,format=CSV

PopulationBeijing21500000Mumbai12478447New York8405837

(9)

Compatibility

• 

The Import command was updated in Maple 2016. By default, Import returns a DataFrame object when importing from the following rectangular formats: Excel, CSV, DIF, TSV. Additionally Import returns a DataSeries object by default when importing from the ODS or SXC formats. Import also supports two new file formats: CNF and GEXF.

• 

The Import command was introduced in Maple 2015.

• 

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

See Also

Export

Formats

Formats,All

ImportData

ImportMatrix

plottools[importplot]