Load CSV data and apply transformation

I want to load data from csv and below is my code

public DataSet loadData(int batchSize, int numClasses) throws IOException, InterruptedException {
		// Load CSV file as a resource from classpath
		ClassPathResource resource = new ClassPathResource("xyz.csv");

		// Define the schema for the dataset (including input features and target labels)
		Schema schema = new Schema.Builder()
				.addColumnString("Book") // String column for categorical encoding
				.addColumnDouble("Amount") // Numerical column
				.addColumnDouble("Rating") // Numerical column
				.build();

		// Define transformation process (converting string column to categorical and one-hot encoding)
		TransformProcess transformProcess = new TransformProcess.Builder(schema)
				.transform(new StringToCategoricalTransform("Book")) // Convert string to categorical (integer)
				.transform(new CategoricalToOneHotTransform("Book")) // One-hot encoding on the categorical column
				.build();

		// Initialize the CSVRecordReader to read data from the CSV file
		try (CSVRecordReader csvReader = new CSVRecordReader(1, ',')) {
			FileSplit fileSplit = new FileSplit(resource.getFile());
			csvReader.initialize(fileSplit);

			// Read the data in batches
			List<List<Writable>> originalData = csvReader.next(batchSize);

			// Apply transformations to the data
			List<List<Writable>> transformedData = LocalTransformExecutor.execute(originalData, transformProcess);

			// Create a CollectionRecordReader to wrap the transformed data
			CollectionRecordReader recordReader = new CollectionRecordReader(transformedData);

			// Define the RecordReaderDataSetIterator to load the dataset into batches
			int inputSize = 2;
			int outputSize = 1; 
			RecordReaderDataSetIterator iterator = new RecordReaderDataSetIterator(recordReader, batchSize, inputSize, inputSize + outputSize);

			// Get the DataSet
			DataSet dataSet = iterator.next();

			// Normalize dataset (if needed)
			DataNormalization normalizer = new NormalizerStandardize();
			normalizer.fit(dataSet);
			normalizer.transform(dataSet);

			return dataSet;
}

on transformation i am getting below error
java.lang.IllegalArgumentException: State names must not be null or empty

basically i have 2 inputs book and amount and one output rating

@nilay do you have more of the stack trace and some of the sample data?