Import
import external data into Maple
Calling Sequence
Parameters
Options
Supported Output Values
Description
Supported Formats
Examples
Compatibility
Import(origin, opts)
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
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.
output : symbol
This option specifies the desired method for representing the imported data in Maple. Supported values are summarized in the following table.
Array
Audio
auto
boolean
boolean_function
ByteArray
DataFrame
DataSeries
function
Graph
Image
list
Matrix
plot
string
table
Vector
Vector[column]
Vector[row]
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.
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.
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.
AMF
BMP
BSON
BYU
CNF
CSV
DGML
DIF
Digraph6
DIMACS
DOT
FASTA
FASTQ
GDF
GenBank
GEXF
GIF
GPX
Graph6
Graphlet
GraphML
GXL
GZIP
INI
JGF
JPEG
JSON
JVX
KML
KMZ
LEDA
MathML
MAT
MatrixMarket
MLA
MPL
MPS
MW
Newick
OBJ
ODS
OFF
Pajek
PLY
PNG
SHP
Sparse6
STL
SXC
Text
TGF
TIFF
TSPLIB
TSV
UBJSON
VTK
XLS
XLSX
XML
XPORT
YAML
ZIP
ZLIB
Import comma-separated tabular data as a DataFrame.
Import⁡example/timedata.csv,base=datadir
DataFrame⁡_rtable36893628856756910308,rows=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,columns=1,2,3,4,5,6
Import an image in JPEG format from a remote URL.
url≔http://www.maplesoft.com/data/examples/jpg/fingerprint.jpg
image≔Import⁡url
_rtable36893628856756911868
ImageTools:-Embed⁡image
Import a cogged gear encoded in Stanford Polygon (PLY) format.
Import⁡example/gear.ply,base=datadir
Import structured data encoded in the JSON format.
Import⁡example/address.json,base=datadir
table⁡phoneNumbers=table⁡type=local,number=+1 (519) 747-2373,table⁡type=tollfree,number=+1 (800) 267-6583,table⁡type=fax,number=+1 (519) 747-5284,address=table⁡province=ON,postalCode=N2V 1K8,city=Waterloo,streetAddress=615 Kumpf Drive,country=Canada,companyName=Maplesoft,founded=1988
Import map data from a KMZ file and present it as a 2-D plot.
Import⁡example/EuropeMap.kmz,view=−13..12,46..64,title=Northwest Europe,titlefont=Times,Bold,20,base=datadir
Import data directly from an input string while specifying the CSV format.
CityData≔City,Population\nBeijing,21500000\nMumbai,12478447\nNew York,8405837\n:
Import⁡CityData,source=direct,format=CSV
DataFrame⁡21500000124784478405837,rows=Beijing,Mumbai,New York,columns=Population
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.
See Also
Export
Formats
Formats,All
ImportData
ImportMatrix
plottools[importplot]
Download Help Document
What kind of issue would you like to report? (Optional)