We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76f7758 commit c05b65eCopy full SHA for c05b65e
mapper.py
@@ -0,0 +1,20 @@
1
+
2
+#!/usr/bin/python
3
4
+import sys
5
6
+#for skipping data analysis on the first line
7
+for j, line in enumerate(sys.stdin, -1):
8
+ if (j>=0):
9
+ #taking each line into a variable "line"
10
+ line = line.strip()
11
+ #taking all the words in the line separated by comma to variable line
12
+ words = line.split(",")
13
+ count = 0
14
+ length = len(words)
15
+ #considering the last 5 elements of the array
16
+ for i in reversed(words):
17
+ if ( count < 5 and i != ""):
18
+ print '%s\t%s' % (i, 1)
19
+ count = count + 1
20
+~
0 commit comments