From the course: Data Science for Java Developers
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Converting CSVs to data objects - Java Tutorial
From the course: Data Science for Java Developers
Converting CSVs to data objects
- [Instructor] So the next step, now that we have our CSV loader and parse CSV functions is to actually create a data class for our grocery records, as well as create a method that will actually take our list of CSV records here and sort of translate that into our data objects. Okay so let's create a new class here. We're going to call that something like grocery record. And this is going to contain the attributes that we have up here. There are only three in this case. So we're going to have member number, date and item description. We're going to say public final string member number, public final date, date. We're going to have to import date of course, the one from Java.util in case that gives you the option. And then we're going to say public final string item description. And we're going to generate a constructor for that as well as a two string method. Okay, so implementing that data class was fairly…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Reducing file size5m 20s
-
(Locked)
Loading data from text files3m 29s
-
(Locked)
Creating a person data class3m 56s
-
(Locked)
Converting strings to data objects5m 39s
-
(Locked)
Loading tab-separated files9m 20s
-
(Locked)
Loading CSVs5m 21s
-
(Locked)
Converting CSVs to data objects7m 4s
-
(Locked)
Challenge: Manipulating data2m 1s
-
(Locked)
Solution: Manipulating data3m 37s
-
(Locked)
-
-
-
-