Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
Why can't I replace a string in a column?
Post Body

Trying to replace some HTML code (string) I have in a column:

df['popup_html_mobile'].str.replace(r"<table>", "<table height='200' width='20%'>", n=1, regex=True)

Ok, great, this works fine. A new dataframe was printed where every row in the column has had its <table> tag replaced.

Let me just try to actually modify the whole column now...

df['popup_html_mobile'] = df['popup_html_mobile'].str.replace(r"<table>", "<table height='200' width='20%'>", n=1, regex=True)

Nope. No effect at all. The string remains unchanged.

What am I doing wrong here?

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
14,207
Link Karma
3,592
Comment Karma
8,855
Profile updated: 1 week ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago