How to specify key value when using ray.data.write_json

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

Hi,
I am new to Ray and I am navigating how to read and write using ray data. My question is regarding how to specify key value when using ray.data.write_json. The default key is “value ”: and I want to change to filenames. For example here I want to change the key vale from “value ” to individual filenames for each numpy ndarray.

image

Hi @Akshay_Kenchappa_Man - here the "__value__" is the column name of numpy ndarray. The column name has to be static and same for all rows. I think you want something like below with two columns:

{"__value__": <ndarray1>, "file_name": <the-file-name-of-ndarray1>}
{"__value__": <ndarray2>, "file_name": <the-file-name-of-ndarray2>}

Where you can get the file name for each ndarray? Can you share the full script?

Hi Chengsu,

I dont think thats what I want. I want something like this:

{“filename1” : [ndarray1]}
{“filename2” : [ndarray2]}
{“filename3” : [ndarray3]}

Attaching full script for reference

@chengsu any updates on this issue?