The API information is being preprocessed using a data frame. In order to eliminate useless text, re.subfunction was used as below.
In this way, you tried to remove the values in parentheses and parentheses in the material column, but all the text behind the parentheses disappeared.
Before this is applied, df,
The second picture is the df after applying the code above.
Sweet potato porridge. Sweet potato, sugar, glutinous rice powder... I don't want to fly the back, I just want to fly the letters in parentheses and parentheses. I think there's a problem with the regex part, so could you take a look?python dataframe re.sub
The current regular expression
This is what it means, and all characters in a sequence of any characters include
. So, I think the result of your question is coming out.
) with a continuous of all characters instead of to resolve it. At the regular ceremony,
r"\([^\)*\)" is expressed like this. Changed
© 2022 pinfo. All rights reserved.