Close
Close window
Import - 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


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

Import

import external data into Maple

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 format, output, source, or base options as described below

Options

base : one of bindir, currentdir, datadir, homedir, mapledir, tempdir, toolboxdir, or worksheetdir.

The base option specifies a base directory. Any local file specified with parameter origin will be interpreted as a relative path under this directory.

For the meaning of each of these values, see kernelopts or interface .

format : string

The format option specifies the import format to use. This must correspond to one of the supported import formats. If omitted, the import format is inferred from the file extension and/or MIME type of origin.

labeltype : one of symbol or string

When output=DataFrame, this option specifies whether non-numeric row and column labels should be expressed as symbols or strings when constructing the DataFrame.

The default is symbol.

output : symbol

This option specifies the desired method for representing the imported data in Maple. Supported values are summarized in the following table.

Supported Output Values

The default is auto, which specifies that a suitable format should be automatically inferred from the format. To determine the default behavior and supported values of output for a particular format, consult the documentation for that format.

plotoptions : list of equation

A list consisting of zero or more plot options described in plot,options . These are only applied if the output is a plot, and are otherwise ignored.

source : one of file or direct

This specifies whether the parameter origin refers to a file or URL (value file) or from a string or ByteArray in memory (value direct). The default is file.

title : string

A string descriptor for the imported object. May be used by any of the import routines as a caption or title in the imported object. Supersedes any title provided in plotoptions.

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

Examples

Import comma-separated tabular data as a DataFrame .

>

Importexample/timedata.csv,base=datadir

1234561Mar 06 01:16 3/7/200526.860912411.414301472×1071.505894402×1070.06482Mar 06 20:12 3/7/200525.756241812.358229695×1072.497614407×1070.05913Mar 06 20:43 3/7/200525.127064283.029212316×1073.314477184×1070.09424Mar 07 00:25 3/7/200525.122490952.496855419×1072.656019993×1070.06375Mar 07 00:44 3/7/200522.759192762.722498752×1072.818590004×1070.03536Mar 07 00:59 3/7/200522.206311129.859010832×1071.029975998×1070.04477Mar 08 00:15 3/8/200522.114772988.333640321×1078.579230226×1070.02958Mar 08 00:16 3/8/200521.412271131.174272859×1071.217998806×1070.03729Mar 08 00:16 3/8/200521.332533154.950350549×1065.239008009×1070.058310Mar 08 00:16 3/8/200520.627523091.765508208×1071.870092003×1070.059228 x 6 DataFrame

(1)

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

(2)
>

imageImporturl

0.1882352941176470.5686274509803920.5058823529411760.4705882352941180.4941176470588240.5058823529411760.4862745098039220.5098039215686270.5019607843137250.5019607843137250.5411764705882350.9843137254901960.9921568627450980.9921568627450981.1.0.9921568627450981.1.1.0.4784313725490200.9607843137254901.1.1.0.9843137254901960.9647058823529410.9960784313725490.9960784313725490.9960784313725490.5176470588235290.9960784313725491.1.0.9882352941176470.9803921568627450.9725490196078431.1.1.0.5019607843137250.9764705882352941.0.9803921568627450.9882352941176471.1.1.1.1.0.4784313725490200.9607843137254900.9921568627450980.9803921568627451.1.0.9882352941176470.9882352941176470.9960784313725490.9960784313725490.5019607843137250.9921568627450981.0.9921568627450981.1.0.9803921568627450.9803921568627451.1.0.4941176470588240.9843137254901961.0.9725490196078430.9725490196078431.1.1.0.9921568627450980.9921568627450980.4980392156862751.0.9921568627450981.1.0.9803921568627450.9960784313725490.9921568627450981.1.0.4941176470588240.9960784313725490.9921568627450981.1.0.9843137254901960.9960784313725490.9960784313725491.1.240 × 256 Array

(3)
>

ImageTools:-Embedimage

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

>

Importexample/gear.ply,base=datadir

Import structured data encoded in the JSON format.

>

Importexample/address.json,base=datadir

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

(4)

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

>

Importexample/EuropeMap.kmz,base=datadir,plotoptions=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\nBeijing,21500000\nMumbai,12478447\nNew York,8405837\n:

>

ImportCityData,source=direct,format=CSV

PopulationBeijing21500000Mumbai12478447New York8405837

(5)

Compatibility

The Import command was updated in Maple 2016. By default, Import returns a DataFrame object when importing from the following rectangular formats: CSV , DIF , TSV , XLS , and XLSX . 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 .

The Import command was updated in Maple 2017.

The base option was introduced in Maple 2017.

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

The labeltype option was introduced in Maple 2023.

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


Download Help Document

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