The objective of this tutorial is to create a Scala Programming project for the data analysis. In which we will take the movie data set and then apply business logic through Scala Programming.
So readers ... are you ready to create a Scala Programming Project. (Data-Analysis)
1. Idea Of Project
a. Fetch raw data from the CSV file. | |
b. Load data into Scala object collection. | |
c. Execute function on the collection, according to input option. | |
d. Show filtered result and return to next input option. |
2. Building Of Project
To run this project you can install VM (Virtual Machine) on your local system and configured Scala on that. After this configuration, your local system will work as a Scala System.
Let us see this project in detail and run it using the below steps.
Movie Analysis (Scala Project) | ||
---|---|---|
It is an example of Scala Programming. | ||
The project has two files. One is a Scala code file and the other is the CSV data file. | ||
Analysis.scala is the Scala code file, which has all analysis logics and methods. | ||
movie.csv is the data file, which uses for analysis. | ||
Click Here To Download the "MovieAnalysis" project zip file. |
3. Run The Project
Description | Linux Terminal | |
---|---|---|
1. | Download MovieAnalysis.zip in the Local System. Click Here To Download the "MovieAnalysis.zip" project folder. |
|
2. | Unzip the project folder in the Local System.
unzip MovieAnalysis.zip
|
|
3. | Set environment variable for Scala commands.
export SCALA_HOME=/home/scala/scala-2.13.2
|
|
4. | Compile the Scala file with package details. After compilation success, a folder with the package name "com" will be created and files compiled inside the folder.scalac src/com/Analysis.scala
|
|
5. | Run Scala compiled file with package details And start the project…scala com.Analysis
|
4. Project Files Description In Details
(i). Analysis.scala
The explanation of each line of the Scala (Analysis.scala) code is mention below.
Analysis.sh file has scala code.
(line 112) is the declaration of Movie class.
(line 22) initialize Movie class collection variable and add values into collection variable from reading movie.csv file.
(line 38,47,65) is methods for executed based on user input values.
(line 83) is a method for providing user input options and calls the appropriate method.
Movie (Movie-Id, Movie-Name, Movie-Budget-Amount, Movie-Gross-Amount, Movie-Release-Date)
The following is the Project terminal that is showing the result after choosing the input and entering the search value.
:) ...enjoy the Scala project.