Import Tabular Data - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Getting Started : How Do I... : Import Tabular Data

How Do I

  

Import Tabular Data?

 

Supported Formats

Using Commands

Data Import Assistant

DataSet Search

Related Topics

See Also

Supported Formats

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.

Using Commands

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.

kerneloptsdatadir;

Import

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.

csvFileFileTools:-JoinPathdatasets,iris.csv,base=datadir:

 

ImportcsvFile;

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

(2.1.1)

 

ImportMatrix

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.

matlabFileFileTools:-JoinPathexample,MatlabData.txt,base=datadir:

AImportMatrixmatlabFile,source=MATLAB,format=entries,transpose=true

ExcelTools Import

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.

 

ExcelFileFileTools:-JoinPathExcel,ExperimentalData.xls,base=datadir:

ExcelTools:-ImportExcelFile;

It is also possible to import information in other spreadsheets in the file as well as specify cell ranges:

ExcelTools:-ImportExcelFile,Sheet2,A2:B12

readdata and scanf

readdata

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.

scanf

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");

892,1,2.3456108

(2.4.2.1)

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

Data Import Assistant

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.

DataSet Search

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:


 

Related Topics

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

Palettes

Context Panel

Command Completion

Equation Labels

Assistants

Maple Help

Plotting Guide

Applications

Example Worksheets

Manuals

Refer to Help>Quick Reference for basic Getting Started tips.

See Also

• 

Input and Output: Programming Guide, Chapter 10

• 

Maple add-in for Excel