3

I know how to read the CSV into numpy and do it from a Python script, and that is good enough for my use case.

But since it has a GUI with data loading functionality, I was expecting it would just work for such an universal data format.

So I tried to go on the menu:

  • File
  • Load data
  • Open file

but when I select a simple CSV file:

i=0; while [ "$i" -lt 10 ]; do echo "$i,$((2*i)),$((4*i))"; i=$((i+1)); done > main.csv

which contains:

0,0,0
1,2,4
2,4,8
3,6,12
4,8,16
5,10,20
6,12,24
7,14,28
8,16,32
9,18,36

an error popup shows on the GUI:

No suitable reader found for file /home/ciro/main.csv

Google led me to this interesting file in the source tree: https://github.com/enthought/mayavi/blob/e2569be1096be3deecb15f8fa8581a3ae3fb77d3/mayavi/tools/data_wizards/csv_loader.py but that just looks like an example of how to do it from a script.

Tested in Mayavi 4.6.2.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985

1 Answers1

3

From the documentation

One needs to have some data or the other loaded before a Module or Filter may be used. Mayavi supports several data file formats most notably VTK data file formats. Alternatively, mlab can be used to load data from numpy arrays. For advanced information on data structures, refer to the Data representation in Mayavi section.

I've tested importing using the GUI on a Asus Laptop Intel CoreTM i7-4510U CPU @ 2.00 GHz with 8 GBs de RAM, using Windows 10, both in and out of a Python virtualenv and always got the same problem:

Load CSV in Mayavi GUI

It all points to CSV files not being directly supported, so had to find another workaround.

My favorite was to use a virtual environment and install on it mayavi, jupyterlab, PyQt5 and Pandas.

Then, using PowerShell, start a Jupyter notebook (jupyter notebook) > Upload > Select the .csv. This imported a 1,25 GBs (153543233 rows x 3 columns) .csv in around 20s, which then became available for usage.

Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145
Patol75
  • 4,342
  • 1
  • 17
  • 28