I did some sql request from postgresql and set it like pandas.DataFrame(). Every rows looks like: '8B1LP1D' where letters ('B' , 'LP' etc.) are delimiters And this aproach:
#formula is a pd.DataFrame with 1 column
for x in formula:
print(re.split('B|LP|D|E|OS|DN',x))
out put looks fine like:
['8', '1', '1']
...
['5', '3', '2']
#etc
But I have to append it in array:
def move_parts(a):
split = []
for x in a:
split.append(re.split('B|LP|D|E|OS|DN',x))
move_parts(formula)
and result was returned like error:
/usr/lib/python3.7/re.py in split(pattern, string, maxsplit, flags)
211 and the remainder of the string is returned as the final element
212 of the list."""
--> 213 return _compile(pattern, flags).split(string, maxsplit)
214
215 def findall(pattern, string, flags=0):
TypeError: expected string or bytes-like object
what is wrong, how to save all splited values to array?
BandLPwith a pipe or comma wouldn't work as you may delete data that you need.