Below is my string in python3
Please assume below string is in a loop
On First loop I get below string string as input
string='{a:1,b:1}{a:2,b:2}{a:3,b:4}'
On Second loop I get below string as input
string='{a:1,b:6}{a:2,b:6}'
On each loop pandas dataframe should created as below:
First loop
a b
1 1
2 2
3 4
second loop
a b
1 6
2 6
Can anyone help with this I am struggling to crack this logic
You can split the input data by
regex
, then parse the output asjson
objectUpdate
Use this regex pattern for matching any character:
r = '({a:.*?[^,],b:.*?[^}]})'
Result: