aws/sagemaker-scikit-learn-extension

Getting error while reading a csv file

Closed this issue · 2 comments

HI @wiltonwu

I did everything that is there in the doc. But when I tried to read the csv file im getting following error:

Traceback (most recent call last):
  File "/Users/surendragandham/PycharmProjects/suren/my_aws/suren/predict.py", line 5, in <module>
    input = input_fn("/Users/surendragandham/PycharmProjects/suren/my_aws/suren/home_rentals.csv", "text/csv")
  File "/Users/surendragandham/PycharmProjects/suren/my_aws/suren/sagemaker_serve.py", line 123, in input_fn
    val = read_csv_data(source=byte_buffer)
  File "/Users/surendragandham/PycharmProjects/suren_conda_env_20_12_19/lib/python3.7/site-packages/sagemaker_sklearn_extension/externals/read_data.py", line 712, in read_csv_data
    _get_reader(source, batch_size),
  File "/Users/surendragandham/PycharmProjects/suren_conda_env_20_12_19/lib/python3.7/site-packages/sagemaker_sklearn_extension/externals/read_data.py", line 159, in _get_reader
    allow_quoted_new_lines=True,
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. mlio.CsvReader(data_reader_params: mlio.DataReaderParams, csv_params: Optional[mlio.CsvParams] = None)

Invoked with: kwargs: dataset=[<in_memory_store address=0x120a40f30 size=0x4e compression='none'>], batch_size=1000, default_data_type=DataType.STRING, header_row_index=None, allow_quoted_new_lines=True

Process finished with exit code 1

Please help asap. Thanks

Hi @surendra1472, which version of mlio do you have installed on your computer? The supported version of mlio is 0.2.4. There was a recent updated release to mlio version 0.3. I will add the details to the README

Hi @wiltonwu, thank you when I point to 0.2.4, the error is not coming.
And it would be great if you can provide an example of read_csv_data method parameters. I am trying to read a csv file, so passed directory as source, but it is just returning the directory name as an array instead of data itself. So please provide an example of how can I use it.