Resample Time-Series CSV
Operator: Abdulla Al Fahad. How tools are built and checked
Rolling hourly readings up to daily totals turns a gap in the data into a low number, and a report that only saw the total would read an outage as a quiet day. That is why the page keeps the count of source rows beside every period. In the bundled meter file, 162 hourly rows rather than 168 show up because a six-hour outage on March 4 left no readings: six of the seven days have 24 source rows and totals between 23.30 and 24.52 kWh, and March 4 has 18 rows and 17.28 kWh.
Key features
- Periods of minutes, hours or days in blocks of any size, plus weeks, months, quarters and years
- A separate aggregation for every column: sum, mean, minimum, maximum, first, last, count or median
- Empty periods left blank, filled with 0, forward filled or linearly interpolated
- Trailing moving average over a window you choose, added as extra columns
- A whole-hour UTC shift that decides where each day begins, with a count of source rows in every period
How rows are bucketed, how empty periods are filled and where time zones matter
Load one table with a timestamp column and at least one numeric column. Timestamps may be ISO (2026-03-02 14:30, with an optional Z or +02:00 offset), month-first or day-first slash dates followed by a time in 24-hour or am/pm form, or 10-digit epoch seconds and 13-digit epoch milliseconds. Slash dates are read day-first only when some value in the column can only be day-first. Up to 300,000 rows are read.
Numbers accept thousands commas, a leading currency symbol and accounting negatives such as (1,250); blank cells and text in a value column are ignored for that cell, and the row's other columns still count.
How it works
Every timestamp is converted to milliseconds, shifted by your UTC offset, and placed in the period that contains it. Minute, hour and day blocks of more than one start at midnight of the first timestamp's day; weeks start on Monday or Sunday; months, quarters and years follow the calendar. The output has one row for every period from the first to the last, including periods with no data, up to 1,000,000 periods.
Each column is aggregated over the numeric values in the period. An empty period counts as 0 for count, and for sum when no fill rule is chosen; for every other aggregation it is blank until you choose a fill. Linear interpolation runs between the neighbouring filled periods in proportion to their start times and never extrapolates past the first or last real value. A moving average of w periods needs w non-blank values, so the first w - 1 rows stay blank.
Common use cases
- Turning a week of 162 hourly kWh readings into daily totals, and spotting from the 18 source rows on March 4 that the low total is missing data rather than low use.
- Rolling 36 months of daily order counts into quarters with sum, while the order value column uses mean and the last stock level uses last.
- Stretching monthly prices (100 on 1 January, 131 on 1 February, 159 on 1 March) onto a daily grid with linear interpolation, which puts 115 on 16 January and 145 on 15 February.
- Cutting sensor logs to 15-minute blocks with maximum, then adding a 4-period moving average to smooth the hourly peak.
How to use this tool
- Drop the table and confirm the timestamp column and the numeric columns that should be rolled up.
- Choose an aggregation for each column: sum for quantities, mean for readings such as temperature.
- Pick the period, the UTC shift if day boundaries matter, and how empty periods should be filled.
- Check the source-row column and the summary counts, then download the CSV or XLSX.
Example
Hourly meter rows, kwh summed and temp_c averaged, day periods
timestamp,kwh,temp_c
2026-03-02 00:00,0.69,5.5
2026-03-02 01:00,...
...
(no rows from 2026-03-04 06:00 to 11:00)Daily output with a 3-period moving average on kwh
period_start source_rows kwh_sum kwh_sum_ma3
2026-03-02 24 24.19
2026-03-03 24 23.30
2026-03-04 18 17.28 21.59
2026-03-05 24 24.29 21.62
2026-03-06 24 24.51 22.03
2026-03-07 24 24.52 24.44
2026-03-08 24 24.20 24.41Common pitfalls
Day boundaries are fixed 24-hour blocks in UTC after your offset, so a daylight-saving change is not modelled. A day with 23 or 25 local hours appears as 24 hours shifted by an hour, and a timestamp without an offset is read as written.
Interpolating a column that is a total, such as daily sales, creates numbers that never happened. Use zero or leave blank for totals, and keep interpolation for readings that vary smoothly, such as temperature or price.
- Choose last, not sum, for any column that is a running level, such as a balance, a stock count or a counter reading. Summing 24 hourly stock levels gives a number that means nothing.
Common errors and how to fix them
- Fewer than 2 rows have a readable timestamp. Check the column and its format.
- The page found no usable timestamps. Pick the right column, or reformat the values as ISO (2026-03-02 14:30) in the source file.
- That would create more than 1,000,000 periods. Use a coarser period.
- A fine period over a long span, such as seconds-level blocks over years, produces too many rows. Choose a longer period or trim the range first.
- The UTC offset must be a whole number of hours from -14 to 14.
- Offsets like +5:30 are not supported. Use a whole-hour offset, or shift the timestamps in the file first.
Where the day starts
Shifting the meter file by 6 hours moves every reading to later in the day, so the first day holds 18 rows (the readings from 00:00 to 17:00 UTC become 06:00 to 23:00) and the data spills into an eighth day with 6 rows. Daily totals change too: March 2 falls from 24.19 to 19.69 kWh.
Use the offset when a business day is not the UTC day. A shop in UTC+6 that closes at 21:00 wants its sales cut at local midnight, not at 18:00 UTC.
Upsampling a coarse series
When the chosen period is finer than the data, the page says so and most periods have no source row. Sum and last keep each original value in its own period. Forward fill repeats that value until the next one, so the hourly temperature gap from 06:00 to 11:00 on March 4 reads 4.6 throughout; linear interpolation draws a line to the next reading instead.
Frequently asked questions
Why is the first week of my weekly output labelled with a date before my data starts?
Weeks begin on Monday or Sunday as you choose, and the label is the first day of that week. If your first row is a Wednesday, its week is labelled with the Monday before it.