parquetRead
Read a Parquet or Arrow file and return a table/timeseries.
Syntax
t = parquetRead(filename) t = parquetRead(filename, Name, Value)
Arguments
- filename
Path to a Parquet or Arrow file.
- t
output argument - table/timeseries object.
Optional pairs Name, Value are:
- "RowTimes", string/datetime/duration
Time values used to define the row times of the resulting timeseries.
Accepted values are:
a scalar string containing the name of a variable in the file,
a
datetimevector,a
durationvector.
If a variable name is specified, the selected variable must contain datetime or duration values. It becomes the time vector of the timeseries and is removed from the data variables.
- "StartTime", scalar datetime/duration
defines the starting time of the timeseries.
- "SampleRate", scalar double
Scalar sampling rate used to build a regularly sampled timeseries.
- "TimeStep", scalar duration/calendarDuration
specifies the interval between samples.
- "OutputType", "auto" (default value) / "table" / "timseries"
specifies the returned object. If "auto" mode,
parquetReadreturns a table unless time-related options are specified.
Description
parquetRead reads data stored in a Parquet (.parquet) or Arrow (.arrow) file.
The imported data are returned as a table by default.
When time-related options are specified, or when "OutputType" is set to
"timeseries", the data are returned as a timeseries.
Columns stored as Parquet datetime values are automatically converted to datetime arrays. Columns stored as Parquet duration values are converted to duration arrays.
When "OutputType" is set to "timeseries" and no explicit time
information is provided, parquetRead automatically searches for datetime and duration variables
in the imported file.
The first datetime or duration variable encountered is used as the row time vector of the resulting timeseries.
Examples
rand("seed", 0) x = ["a"; "b"; "b"; "c"; "a"]; x1 = floor(rand(5,1)*5)-1.5; x2 = -floor(rand(5,1)*5)+0.5; t = table(x, x1, x2, "VariableNames", ["x", "x1", "x2"]); parquetWrite(fullfile(TMPDIR, "table.parquet"), t); t2 = parquetRead(fullfile(TMPDIR, "table.parquet")) // t2 = [5x3 table] // // x x1 x2 // ___ ____ ____ // // a -0.5 -2.5 // b 1.5 -3.5 // b -1.5 -2.5 // c -0.5 -3.5 // a 1.5 0.5
rand("seed", 0) x = ["a"; "b"; "b"; "c"; "a"]; h = hours([1:5]'); x1 = floor(rand(5,1)*5)-1.5; x2 = -floor(rand(5,1)*5)+0.5; t = table(x, h, x1, x2, "VariableNames", ["x", "hours", "x1", "x2"]); parquetWrite(fullfile(TMPDIR, "timeseries.parquet"), t); t2 = parquetRead(fullfile(TMPDIR, "timeseries.parquet"), "OutputType", "timeseries") // t2 = [5x3 timeseries] // // hours x x1 x2 // ________ ___ ____ ____ // // 01:00:00 a -0.5 -2.5 // 02:00:00 b 1.5 -3.5 // 03:00:00 b -1.5 -2.5 // 04:00:00 c -0.5 -3.5 // 05:00:00 a 1.5 0.5 t3 = parquetRead(fullfile(TMPDIR, "timeseries.parquet"), "RowTimes", "hours") // t3 = [5x3 timeseries] // // hours x x1 x2 // ________ ___ ____ ____ // // 01:00:00 a -0.5 -2.5 // 02:00:00 b 1.5 -3.5 // 03:00:00 b -1.5 -2.5 // 04:00:00 c -0.5 -3.5 // 05:00:00 a 1.5 0.5
dt = datetime(2026, 1, 1, 9, 30, 45):calmonths(1):datetime(2026, 12, 31); dt = dt'; d = [1:12]'; i = int32(d); str = "A" + string(d); b = [%f; %t; %t; %f; %f; %t; %f; %f; %f; %t; %t; %f]; t = table(dt, d, i, str, b, "VariableNames", ["date", "double", "int32", "string", "bool"]); parquetWrite(fullfile(TMPDIR, "table3.parquet"), t); t2 = parquetRead(fullfile(TMPDIR, "table3.parquet"), "StartTime", datetime(2026, 6, 1), "SampleRate", 1/3600) // t2 = [12x5 timeseries] // // Time date double int32 string bool // ___________________ ___________________ ______ _____ ______ ____ // // 2026-06-01 00:00:00 2026-01-01 09:30:45 1 1 A1 F // 2026-06-01 01:00:00 2026-02-01 09:30:45 2 2 A2 T // 2026-06-01 02:00:00 2026-03-01 09:30:45 3 3 A3 T // 2026-06-01 03:00:00 2026-04-01 09:30:45 4 4 A4 F // 2026-06-01 04:00:00 2026-05-01 09:30:45 5 5 A5 F // 2026-06-01 05:00:00 2026-06-01 09:30:45 6 6 A6 T // 2026-06-01 06:00:00 2026-07-01 09:30:45 7 7 A7 F // 2026-06-01 07:00:00 2026-08-01 09:30:45 8 8 A8 F // 2026-06-01 08:00:00 2026-09-01 09:30:45 9 9 A9 F // 2026-06-01 09:00:00 2026-10-01 09:30:45 10 10 A10 T // 2026-06-01 10:00:00 2026-11-01 09:30:45 11 11 A11 T // 2026-06-01 11:00:00 2026-12-01 09:30:45 12 12 A12 F
Caution
![]() | This function converts data:
|
See also
- parquetWrite — Write table or timeseries to a Parquet or Arrow file
- table — create a table from variables
- timeseries — create a timeseries - table with time as index
- datetime — create points in time
- duration — create a duration - duration in hours, minutes and seconds
History
| Version | Description |
| 2026.1.0 | Function added. |
| Report an issue | ||
| << csvWrite | Spreadsheet | parquetWrite >> |
