Importing and Reloading Data
When you import a CSV file, MIDAS creates a dataset with a data type set for each column. MIDAS detects the type of each column from its values, and empty cells become missing values.
When you update the original CSV file, reloading replaces the rows of the dataset with the rows of the new file. Reloading does not change the names and types of the existing columns, so the Derived Datasets, models, and report elements created from the dataset remain. MIDAS recomputes them with the new data.
Importing a File
The screen you import from determines which project the imported dataset goes into. When you import a CSV file on the launcher screen, MIDAS creates a dataset from the CSV file and a new project that contains the dataset. When you import with Data > Import Data... on the project screen, MIDAS adds the dataset to the open project.
Open File and dropping a file on the launcher screen do not let you specify the header row or the delimiter. MIDAS uses the first row as the column names and determines the delimiter from the file extension. Import a CSV file without a header row, or one whose delimiter does not match its extension, with Import Data..., where you can specify the header row and the delimiter.
Besides CSV, MIDAS can import TSV, Parquet, and JSON files. On the launcher screen, you can also open an MDS file, the MIDAS project file, and import a ZIP file that bundles data files. MIDAS cannot import Excel files, so save the file as CSV in Excel and import the CSV file.
Importing from a URL
MIDAS can import a CSV file published on the Web directly from its URL. Enter the URL of the CSV file in Open from URL on the launcher screen or in the URL tab of Import Data.... The URLs that MIDAS can fetch are restricted. For the list of restrictions, see External communication.
When you open the MIDAS URL with #csv= and the percent-encoded URL of a CSV file appended, MIDAS opens a new project with that CSV file imported. For example, opening https://app.midas-app.org/#csv=https%3A%2F%2Fexample.com%2Fdata.csv makes MIDAS import https://example.com/data.csv. A project opened from a URL with #csv= cannot be saved in the browser, so to keep it, export it as an MDS file with File > Export Project....
Data Types
Each MIDAS column has one of the following 7 data types.
| Data type | Values |
|---|---|
int64 | Integers |
float64 | Numbers that can have a fractional part |
string | Strings |
boolean | true and false |
date | Dates |
datetime | Date-times to the millisecond |
enum | Values in the Enum definition |
A column of any data type can hold missing values in addition to its values.
Importing does not create enum columns. To make a column enum, define an Enum in the Manage Enums tab and convert the column in the Convert Column Types tab.
MIDAS sets the initial measurement scale of each column from its data type. For measurement scales, see Data Types and Measurement Scales.
CSV Type Detection
For each column of a CSV file, MIDAS tries the types in the order boolean, int64, float64, and date or datetime, and gives the column the first type that can interpret all of its non-empty values. A column that contains a value no type can interpret, and a column with no non-empty values, become string. The values that can be interpreted as boolean are those that match one of true, false, t, f, yes, no, y, n, 1, and 0, ignoring case. A column that can be interpreted as dates or date-times becomes datetime if even one value has either a time other than 00:00:00 or a time zone offset such as Z or +09:00, and date otherwise.
For example, in the following columns, the type that MIDAS detects differs from the type you would expect from the values in a spreadsheet.
- A column of only
0and1becomesint64, notboolean - A column that contains even one number with a leading zero such as
007, a number with thousands separators such as1,234, or an integer whose absolute value exceeds 2^53 (about 9×10^15), such as a 20-digit ID, becomesstring - A column that contains even one date written with the month or day first, such as
01/15/2024, or with a 2-digit year, such as24-01-15, becomesstring. MIDAS detects as dates only values written with a 4-digit year first, such as2024-01-15or2024/1/15
A column of numbers with thousands separators can be converted to int64 or float64 by specifying the notation in The Convert Column Types Tab.
MIDAS treats a date-time without a time zone offset as a time in Coordinated Universal Time (UTC). It treats a date-only value in a datetime column as 00:00 UTC on that day. The Data Table shows datetime values converted to the time zone of the browser. So when the time zone of the browser is Japan time, the Data Table shows a date-time recorded in Japan time without an offset as a time 9 hours later. To have the Data Table show the same times as the CSV, add +09:00 after the seconds of the date-times recorded in Japan time, as in 2024-01-15 10:30:00+09:00, before importing. A column that contains a value with a time zone offset after a time without seconds becomes string.
When MIDAS counts a datetime column by dividing it into time intervals, it divides the column at the times of the browser's time zone. So the counts of the Datetime Histogram in Graph Builder, the Date Distribution in the Statistics tab, and the Time Bin stat of Custom Graph can change with the time zone of the browser that shows the same data. For example, with 1-day intervals, rows from 15:00 to 24:00 UTC fall into the next day's interval in a browser set to Japan time. MIDAS divides a date column by dates, so the counts of a date column do not change with the time zone of the browser.
Missing Values
MIDAS turns empty cells of a CSV file into missing values. In columns of types other than string, cells that contain only whitespace also become missing values.
MIDAS does not turn strings such as NA, NULL, and - into missing values; it imports them as strings. So a column that mixes numbers and these strings becomes string.
Reloading a Dataset
Reload Dataset... replaces the rows of one dataset with the rows of the CSV file you choose. This menu item is in the table menu of the Data Table, the dataset menu of Project Overview, and the dataset menu of Project Lineage. Reload Source Dataset... in the table menu of the Data Table for a Derived Dataset reloads the imported datasets among those the Derived Dataset depends on.
MIDAS records the file you choose for a reload and uses that file for the next reload. Data > Reload All Datasets, which reloads datasets together, also uses the recorded files. MIDAS can record a file only in browsers that can reopen a chosen file later, such as Chrome and Edge. MIDAS does not record the file used at import, so choose the file again the first time you reload. Reload All Datasets reloads only datasets imported from a URL and datasets whose file MIDAS has recorded.
Files You Can Reload From
A CSV file used to reload an imported dataset must have the same number of columns, the same column names and order in the header row, and the same encoding as the original file.1 Import a CSV file with added columns as a separate dataset.
When reloading an imported dataset, MIDAS does not detect the column types again; it turns values that cannot be converted to the original types into missing values and shows their number in a warning. To detect the column types again, import the CSV file as a separate dataset.
What Reloading Keeps and Removes
Reloading an imported dataset replaces only the rows, so the dataset name, renamed column names, measurement scales, and column display formats remain. The Derived Datasets, models, and report elements that depend on the dataset also remain. For what is recomputed, see Recomputation When a Dataset Changes.
Reloading removes the row exclusions, row comments, and row selection. This is because MIDAS renumbers the rows when reloading replaces them.
Prevent Reload
MIDAS does not replace the rows of a dataset with Prevent Reload turned on in any reload. Use Prevent Reload to keep a dataset as it was at a certain point in time while updating other datasets with Reload All Datasets. Turn this setting on and off in the table menu of the Data Table and in the dataset menu of Project Overview.
Creating a Dataset
Data > New Dataset... creates a dataset with no rows, in which you decide only the column names and types, without importing a file. Enter the rows with Edit Data in the Data Table. For Edit Data, see The Data Table Tab.
A dataset created with New Dataset... is for entering by hand a table that supports your analysis. For example, create a table that maps IDs to names. In the SQL Query Editor tab, add to each row of an imported dataset the name from the table whose ID matches, and you can aggregate by name instead of by ID.
Unlike an imported dataset, a dataset created with New Dataset... can have its values changed with Edit Data. The values of an imported dataset cannot be changed because MIDAS creates them only from the original file. To correct the values of an imported dataset, correct the original file and reload.
When reloading a dataset created with New Dataset..., MIDAS matches the columns by name, does not reload if a value cannot be converted, and does not keep the column display formats. If the new file contains all of the current columns, you can reload from a file with added columns or with the columns in a different order. MIDAS adds the columns that exist only in the new file to the dataset. If the new file contains even one value that cannot be converted to the type of a current column, MIDAS does not reload and leaves the dataset as it was.
See also
Footnotes
-
For a column renamed with Edit Column Name, the header row of the new file still has the column name of the original file. ↩
Also available as a Markdown file.