Reputation:
have a txt file contains many values
Used regex
'many_espd': '(\d+)'
This gets my requirement but how to take all those values and make it a df
Upvotes: 0
Views: 37
Reputation: 521639
Try this option, which creates a single column data frame from your list of matching digits:
result_list = re.findall(r"'many_espd': '(\d+)'", text)
df = DataFrame({'espd': result_list})
Note that if you are actually using regex to parse JSON content, then stop here, and instead look into using a JSON parser.
Upvotes: 1