In [48]:
### DO NOT EDIT OR CHANGE THE CODE IN THIS DOCUMENT IN ANY WAY!!!!!
### READ ONLY
step_1 = open("Sample_redone.txt", "r")
step_2 = step_1.read()
In [183]:
step_3 = step_2.split(sep="/m")
step_3
Out[183]:
In [184]:
step_4 = list(map(lambda x: x.split(sep="|"), step_3))
step_4
Out[184]:
In [187]:
import numpy as np
step_5 = np.asarray(step_4)
list(range(1, len(step_5)))
step_5[2]
### break
Out[187]:
In [172]:
r = (1,2,3,4,5)
p = (3, 4)
r.append(p)
In [211]:
def final_comp(y):
mylist = []
for x in range(0, ((len(y)-1))):
temp = list(map(lambda x: x.split(sep="^"), (y[x])))
print(final_comp(step_5))
In [179]:
def final_comp3(y):
(list(map(lambda x: x.split(sep="^"), (y[x])))) for x in y
print(final_comp3(step_5))
In [215]:
def final_comp2(y):
for i in y:
temp = list(map(lambda x: x.split(sep="^"), i))
print(temp)
### Objects of objects, flat-map, or flatten the resulting objects into a single object
g = final_comp2(step_5)
print(g)
In [156]:
for i in step_5:
list(map(lambda x: x.split(sep="^"), (i)))
In [126]:
### resume
step_5.split(sep="^")
In [52]:
step_6a = list(map(lambda x: x.split(sep="^"), (step_5[0])))
step_6b = list(map(lambda x: x.split(sep="^"), (step_5[1])))
step_6c = list(map(lambda x: x.split(sep="^"), (step_5[2])))
step_6d = list(map(lambda x: x.split(sep="^"), (step_5[3])))
step_6e = list(map(lambda x: x.split(sep="^"), (step_5[4])))
step_6f = list(map(lambda x: x.split(sep="^"), (step_5[5])))
In [201]:
step_7 = [step_6a, step_6b, step_6c, step_6d, step_6e, step_6f]
step_7[0]
Out[201]:
In [203]:
list_keys = list()
for x in range(len(step_8)):
list_keys.append("Field" + str(x+0))
list_keys
Out[203]:
In [210]:
step_9 = crazy_function_segment(step_7)
crazy_function_field(step_7[0])
Out[210]:
In [ ]:
In [208]:
def function_segment(y):
temp_list = list()
for x in range(len(y)):
temp_list.append("Segment" + str(x+1))
new = dict(zip(temp_list, y))
return new
In [209]:
def function_field(y):
temp_list = list()
for x in range(len(y)):
temp_list.append("Field" + str(x+1))
new = dict(zip(temp_list, y))
return new
### zero based ordering ex. (01, 02, ..., 10, 11)
In [224]:
d= dict(zip(list_keys, step_8))
d
In [ ]: