I want to extract userhandles from retweets, ie; any username between "RT @username:xyzxyzxyz" to a new column. I did the following
df = pd.read_csv("string.csv")
for index,row in df.iterrows():
df['Influencers'] = df['Tweet'].str.extract("\(@*?)\:")
df.to_csv('string3.csv', index=False)
It generated following error :
File "C:\ANACONDA\lib\re.py", line 251, in _compile
raise error, v # invalid expression
error: unbalanced parenthesis
Sample DF:
df=pd.DataFrame({"Tweet": ["RT @saikatd: Are editors involved in the transfer of Income Tax officials?","RT @CLManojET: Can't allow L-G's fantasy of running a parallel administration"," Fairplay n equity 2 consumers 2 be ensured"]})