Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have an datframe like this:
product_name image url product A product B https://... product c
here product A and B don't have any image url. How I can set an defult image url for product A and product c ?
using np.where, you can assign a default URL whereever the image URL is null
df['image_url'] = np.where(df['image_url'].isna(), 'http://default.url', df['image_url']) df
product_name image_url 0 product A http://default.url 1 product B https://... 2 product c http://default.url
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.