FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MachineLearning-using-R/CleanData.java at master · a-shlash/MachineLearning-using-R · GitHub
a-shlash
/
MachineLearning-using-R
Public
forked from
abhishek-ch/MachineLearning-using-R
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
MachineLearning-using-R
/
CleanData.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
102 lines (90 loc) · 2.23 KB
Breadcrumbs
MachineLearning-using-R
/
CleanData.java
Copy path
File metadata and controls
102 lines (90 loc) · 2.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package
com
.
finance
;
import
java
.
io
.
FileReader
;
import
java
.
io
.
IOException
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
List
;
import
au
.
com
.
bytecode
.
opencsv
.
CSVReader
;
public
class
CleanData
{
public
static
void
main
(
String
[]
args
)
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
sublist
=
new
ArrayList
<
String
>();
List
<
String
[]>
readCSV
=
readCSV
(
"D:/Work/RWorkSpace/icici.csv"
);
for
(
int
i
=
0
;
i
<
readCSV
.
size
();
i
++)
{
String
[]
strings
=
readCSV
.
get
(
i
);
String
str
=
strings
[
2
];
if
(
str
.
contains
(
"ATM/CASH"
) ||
str
.
contains
(
"NFS/CASH"
) ){
String
[]
split
=
str
.
split
(
" "
);
list
.
add
(
split
[
0
]);
//ATM
sublist
.
add
(
"-"
);
}
else
if
(
str
.
contains
(
"BIL"
)){
String
[]
split
=
str
.
split
(
"/"
);
list
.
add
(
"PAYMENT"
);
sublist
.
add
(
split
[
2
]);
}
else
if
(
str
.
contains
(
"IRCTC"
)){
String
[]
split
=
str
.
split
(
" "
);
list
.
add
(
split
[
0
]);
//ATM
sublist
.
add
(
"-"
);
}
else
if
(
str
.
startsWith
(
"NEFT"
)){
list
.
add
(
"NEFT"
);
//ATM
sublist
.
add
(
"-"
);
}
else
if
(
str
.
contains
(
"SPENCERS"
)){
list
.
add
(
"RETAIL"
);
//ATM
sublist
.
add
(
"-"
);
}
else
if
(
str
.
contains
(
"GANESH INFRATECH"
) ||
str
.
contains
(
"BHOPAL"
)){
list
.
add
(
"BHOPAL"
);
//ATM
sublist
.
add
(
"-"
);
}
else
{
String
[]
split
=
str
.
split
(
" "
);
if
(
split
.
length
>
0
){
if
(
split
.
length
==
2
){
list
.
add
(
split
[
0
]+
"."
+
split
[
1
]);
}
else
{
list
.
add
(
getRefreshed
(
split
[
0
]));
}
}
else
{
String
[]
quote
=
str
.
split
(
"/"
);
if
(
quote
.
length
>
0
){
list
.
add
(
getRefreshed
(
quote
[
0
]));
}
else
{
list
.
add
(
str
);
}
}
sublist
.
add
(
"-"
);
}
}
// for (String val : list)
// {
// System.out.println(val);
// }
for
(
String
val
:
sublist
)
{
System
.
out
.
println
(
val
);
}
}
private
static
String
getRefreshed
(
String
output
){
String
sub
=
output
;
if
(
sub
.
contains
(
"TATA"
)){
sub
=
"TATA"
;
}
else
if
(
sub
.
contains
(
"rent"
)){
sub
=
"RENT"
;
}
return
sub
;
}
public
static
List
<
String
[]>
readCSV
(
String
fileName
){
try
{
CSVReader
reader
=
new
CSVReader
(
new
FileReader
(
fileName
),
','
);
List
<
String
[]>
readAll
=
reader
.
readAll
();
return
readAll
;
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
null
;
}
}
Back
|
FazBrowse Home
|
New Git URL