Skip to content Skip to sidebar Skip to footer

Copy Warning In Pandas Series

I have a column which is in datetime format and I want to change it to be date format. db['Date'] = db['Date'].apply(lambda x: x.date()) And then I got a warning: __main__:1: Sett

Solution 1:

I set values using

df['THING'] = df['THING'].apply(function)

all the time. As Wes points out in his notes on the subject, the warning is a heuristic. It's not always the case that when you're assigning in this way, you're setting on a view. Make the assignment, then call df.head() (or whatever) and see if your frame has actually changed. If it has, who cares if there's a warning?

Post a Comment for "Copy Warning In Pandas Series"