How do I avoid a SettingWithCopyWarning in pandas?

Опубликовано: 02 Август 2016
на канале: Data School
44,892
1.6k

If you've been using pandas for a while, you've likely encountered a SettingWithCopyWarning. The proper response is to modify your code appropriately, not to turn off the warning! In this video, I'll show you two common scenarios in which this warning arises, explain why it's occurring, and then demonstrate how to address it.

SUBSCRIBE to learn data science with Python:
https://www.youtube.com/dataschool?su...

JOIN the "Data School Insiders" community and receive exclusive rewards:
  / dataschool  

== RESOURCES ==
GitHub repository for the series: https://github.com/justmarkham/pandas...
"copy" documentation: http://pandas.pydata.org/pandas-docs/...
"loc" documentation: http://pandas.pydata.org/pandas-docs/...
Longer explanation of SettingWithCopyWarning: http://tomaugspurger.github.io/modern...
Returning a view versus a copy: http://pandas.pydata.org/pandas-docs/...

== LET'S CONNECT! ==
Newsletter: https://www.dataschool.io/subscribe/
Twitter:   / justmarkham  
Facebook:   / datascienceschool  
LinkedIn:   / justmarkham