How Do I
Import Tabular Data?
Data Import Assistant
Maple supports many different import and export file formats including csv, tsv, Excel, ods, and more.
To see a full list of supported formats, see the Formats help page.
Many commands support importing data files directly from files stored on disk or online. Maple stores many sample data files in the Maple data directory. This directory can be found under "data" in the Maple installation folder.
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. 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 SXC or TSV formats.
Import comma-separated tabular data as a DataFrame.
csvFile â‰” FileTools:-JoinPath⁡datasets,iris.csv,base=datadir:
Import data directly from an input string while specifying the CSV format.
DataFrame⁡_rtable18446746122870092494,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,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,columns=Sepal Length,Sepal Width,Petal Length,Petal Width,Species
CityData â‰” City,Population
The ImportMatrix command can also be used to import tabular data and store the data as a Vector or Matrix. In contrast to the Import command, the ImportMatrix command assumes that the incoming data is tabularly structured information, and cannot be used to import images, or other file types.
Import a MATLAB® ASCII data file with entries format.
matlabFile â‰” FileTools:-JoinPath⁡example,MatlabData.txt,base=datadir:
A â‰” ImportMatrix⁡matlabFile,source=MATLAB,format=entries,transpose=true
The Import command in the ExcelTools package is designed for working with Excel spreadsheet files providing a mechanism to import full spreadsheets or specific ranges of cells stored in Excel spreadsheets.
It is also possible to import information in other spreadsheets in the file as well as specify cell ranges:
readdata and scanf
The readdata command reads numeric data from a text file into Maple. The data in the file must consist of integers or floating-point values arranged in columns, separated by white space, and it is returned in a list or list of lists.
The scanf command allows you to read from the terminal using a specified format. The formatting information is provided by a format string.
The sscanf command below reads an integer, a space, a character, and a floating-point value from the string given as the first argument.
sscanf("892 123.456E7","%d %c%f");
Several format codes are available for use with scanf. A few of the more commonly used ones are mentioned here.
"d" -- integer
"f" -- floating-point number
"c" -- character
"s" -- string
"a" -- Maple expression
The Import Data Assistant is an interactive interface to import external data into Maple. You can also launch the dialog from the menu bar. From the Tools menu, select Assistants and then Import Data.
The Data Set Search assistant is an interactive graphical interface for searching built-in and online data sources.
It is possible to search for available data sources from Maple's help search box:
The How Do I... topics cover the essentials for doing mathematics in Maple. Learn more about available tools and features, such as palettes and the context panel.
How Do I...
...Enter a Complex Number?
...Enter a Function?
...Enter a Matrix?
...Enter a Simple Expression?
...Evaluate an Expression?
...Plot a Function?
...Plot a Straight Line?
...Plot Multiple Functions?
...Solve an Ordinary Differential Equation?
...Work with Random Generators?
Tools and Features
Refer to Help>Quick Reference for basic Getting Started tips.
Input and Output: Programming Guide, Chapter 10
Maple add-in for Excel
Download Help Document
What kind of issue would you like to report? (Optional)