Closed spleshakov closed 3 years ago
@spleshakov Have you seen the astype function: https://danfo.jsdata.org/api-reference/dataframe/dataframe.astype It might be what you are looking for unless you need to explicitly set the type on read.
Although, it is not ideal since it is an extra line of code and extra operation, but it works for me, thank you.
Page https://danfo.jsdata.org/api-reference/input-output/danfo.read_csv says I can specify any option supported by tensorflow (
csvConfigs: other supported Tensorflow csvConfig parameters
)Their documentation says
csvConfig.columnConfigs[columnHeader].dtype
can be any value ofint32, float32, bool, or string
(https://js.tensorflow.org/api/latest/#data.csv)However, running the below code doesn't convert the columns values into strings
service_areas.csv
javascript
results in output
This is likely a bug on tensorflow side, since this
switch
clause https://github.com/tensorflow/tfjs/blob/623da7ecbada115425888c62bd65df685e2bdd75/tfjs-data/src/datasets/csv_dataset.ts#L253 has all specified values butstring
. Default -parsedValue = valueAsNum;
I did open an issue with them https://github.com/tensorflow/tfjs/issues/4962, but code snippet using danfo isn't working for them and I'm not familiar with tensorflow.js, so I can't provide a code to reproduce an issue