Am 12.07.19 um 17:38 schrieb Riccardo (Jack) Lucchetti:
On Fri, 12 Jul 2019, Allin Cottrell wrote:
> On Fri, 12 Jul 2019, Sven Schreiber wrote:
>
>> Something else: BTW, the guide mentions that --send-data is not
>> available with Ox, but is silent for the Python case. Actually Artur and
>> I are working (not too hard) on more tools for passing stuff to Python,
>> but enabling --send-data would also be nice. What Python/numpy functions
>> would you need to make this work?
>
> Basically just a CSV reading function -- and presumably a target
> structure that handles variable names, to make a distinction with just
> sending data in matrix form.
In fact, I was thinking about this some time ago: our --send-data
apparatus goes back to a time when we didn't have all the data types we
have now, particularly bundles. It would be really cool if we could pass
bundles to languages that support some variant of associative arrays, eg
R, where they call them lists, or Python, where they call them
dicrtionaries (IIRC). That would give us enormnous flexibility. Of
course, (a) we'd have to write import-export functions for those
languages and (b) we'dd introduce some dependencies in the target
languages, but I reckon that, given the mechanism we have for
serialising a bundle as an xml file, that would be doable.
Proof-of-concept:
I would rather favour the json-format as an exchange protocol. Json was
meant to be a successor of xml for some good reasons:
- A json-file can "easily" be read and written by humans.
- Processing a json -- given a clever structure -- can be parallelized
(even though, I guess, this is of no practical relevance, yet, as we are
not operating in the big data sphere).
- json-files are widely used for communication especially for
configuring processes. All relevant software packages can process json
files.
Currently, gretl can read-in json-files and converts them into a bundle
or array of bundles. But there is no way function for writing a bundle's
underlying xml-structure in json-format. Having a converter xml-->json
might be all we need. Given that xml is a structured data format this
should be possible or there may even exist a library for this.
Best,
Artur