DIF - Maple Help

DIF (.dif) File Format

Data Interchange Format

Description

 • DIF (Data Interchange Format) is a text-based file format for spreadsheet and tabular data. It is now primarily used for data exchange between spreadsheet programs.
 • The general-purpose commands Import and Export also support this format.
 • The default output from Import for this format is a DataFrame. To produce a Matrix, use Import(...,output=Matrix).

Examples

Import data from an DIF spreadsheet on historical Maple release dates.

 > $\mathrm{Import}\left("example/timeline.dif",\mathrm{base}=\mathrm{datadir}\right)$
 $\begin{array}{c}\left[\begin{array}{ccc}{}& {\mathrm{Year}}& {\mathrm{Release}}\\ {1}& {1990}& {"Maple V"}\\ {2}& {1992}& {"Maple V R2"}\\ {3}& {1994}& {"Maple V R3"}\\ {4}& {1996}& {"Maple V R4"}\\ {5}& {1997}& {"Maple V R5"}\\ {6}& {1999}& {"Maple 6"}\\ {7}& {2001}& {"Maple 7"}\\ {8}& {2002}& {"Maple 8"}\\ {9}& {2003}& {"Maple 9"}\\ {10}& {2004}& {"Maple 9.5"}\\ {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{26 x 2 DataFrame}}\end{array}$ (1)

Import the same data as a Matrix.

 > $\mathrm{Import}\left("example/timeline.dif",\mathrm{base}=\mathrm{datadir},\mathrm{output}=\mathrm{Matrix}\right)$
 $\begin{array}{c}\left[\begin{array}{cc}{"Year"}& {"Release"}\\ {1990}& {"Maple V"}\\ {1992}& {"Maple V R2"}\\ {1994}& {"Maple V R3"}\\ {1996}& {"Maple V R4"}\\ {1997}& {"Maple V R5"}\\ {1999}& {"Maple 6"}\\ {2001}& {"Maple 7"}\\ {2002}& {"Maple 8"}\\ {2003}& {"Maple 9"}\\ {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{27 × 2 Array}}\end{array}$ (2)

Export a random matrix to a DIF spreadsheet in the home directory of the current user.

 > $M≔\mathrm{LinearAlgebra}:-\mathrm{RandomMatrix}\left(100,2\right):$
 > $\mathrm{Export}\left("example.dif",M,\mathrm{base}=\mathrm{homedir}\right)$
 ${2482}$ (3)

Compatibility

 • With Maple 2016, the Import command applied to DIF files now produces DataFrame objects by default.