# Reading CSV file with Strings

**URL:** <https://community.konduit.ai/t/reading-csv-file-with-strings/843>\
**Category:** DL4J\
**Created:** [September 8, 2020, 5:00pm UTC](https://community.konduit.ai/t/reading-csv-file-with-strings/843 "2020-09-08T17:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Demo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/demo/32/303_2.png) [@Demo](https://community.konduit.ai/u/Demo)\
**Post date:** [September 8, 2020, 5:00pm UTC](https://community.konduit.ai/t/reading-csv-file-with-strings/843/1 "2020-09-08T17:00:21Z")

</div>

Hi,

I am very new to deeplearning4j, however, I wasn’t able to find anything about this on Google.  
I am reading a CSV file, get its data as a RecordReaderDataSetIterator and iterate over this. However, a column of the CSV contains strings such as “Male” and “Female”.  
While iterating, it throws an Exception → “value is non-numeric”.

```
RecordReader recordReader = new CSVRecordReader(0, ',');
recordReader.initialize(new FileSplit(new File("C://Users//Username//Desktop//Vocab Train.csv")));
int labelIndex = 0;
int numClasses = 10;
int batchSize = 24280;

RecordReaderDataSetIterator iterator = new RecordReaderDataSetIterator(recordReader,batchSize,labelIndex,numClasses);
iterator.setCollectMetaData(true);

DataSet allData = iterator.next();

```

How do I convert the string in this file to a numeric value and get a dataset as output?

Thank you very much in advance.

---

<div class="post-metadata">

**Author:** ![cagneymoreau](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/cagneymoreau/32/296_2.png) [@cagneymoreau](https://community.konduit.ai/u/cagneymoreau)\
**Post date:** [September 8, 2020, 7:50pm UTC](https://community.konduit.ai/t/reading-csv-file-with-strings/843/2 "2020-09-08T19:50:18Z")

</div>

Download the examples git. There is a simple classifier example that covers this exact challenge.

package org.deeplearning4j.examples.dataexample.BasicCSVClassifier
