Python pandas.core.common.SettingWithCopyWarning() Examples
The following are 7
code examples of pandas.core.common.SettingWithCopyWarning().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.core.common
, or try the search function
.
Example #1
Source File: test_chaining_and_caching.py From recruit with Apache License 2.0 | 5 votes |
def test_detect_chained_assignment_warnings(self): with option_context("chained_assignment", "warn"): df = DataFrame({"A": ["aaa", "bbb", "ccc"], "B": [1, 2, 3]}) with tm.assert_produces_warning(com.SettingWithCopyWarning): df.loc[0]["A"] = 111
Example #2
Source File: test_chaining_and_caching.py From recruit with Apache License 2.0 | 5 votes |
def test_detect_chained_assignment_warnings_filter_and_dupe_cols(self): # xref gh-13017. with option_context("chained_assignment", "warn"): df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, -9]], columns=["a", "a", "c"]) with tm.assert_produces_warning(com.SettingWithCopyWarning): df.c.loc[df.c > 0] = None expected = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, -9]], columns=["a", "a", "c"]) tm.assert_frame_equal(df, expected)
Example #3
Source File: test_chaining_and_caching.py From vnpy_crypto with MIT License | 5 votes |
def test_detect_chained_assignment_warnings(self): # warnings with option_context('chained_assignment', 'warn'): df = DataFrame({'A': ['aaa', 'bbb', 'ccc'], 'B': [1, 2, 3]}) with tm.assert_produces_warning( expected_warning=com.SettingWithCopyWarning): df.loc[0]['A'] = 111
Example #4
Source File: test_chaining_and_caching.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_detect_chained_assignment_warnings(self): with option_context("chained_assignment", "warn"): df = DataFrame({"A": ["aaa", "bbb", "ccc"], "B": [1, 2, 3]}) with tm.assert_produces_warning(com.SettingWithCopyWarning): df.loc[0]["A"] = 111
Example #5
Source File: test_chaining_and_caching.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_detect_chained_assignment_warnings_filter_and_dupe_cols(self): # xref gh-13017. with option_context("chained_assignment", "warn"): df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, -9]], columns=["a", "a", "c"]) with tm.assert_produces_warning(com.SettingWithCopyWarning): df.c.loc[df.c > 0] = None expected = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, -9]], columns=["a", "a", "c"]) tm.assert_frame_equal(df, expected)
Example #6
Source File: test_chaining_and_caching.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_detect_chained_assignment_warnings(self): # warnings with option_context('chained_assignment', 'warn'): df = DataFrame({'A': ['aaa', 'bbb', 'ccc'], 'B': [1, 2, 3]}) with tm.assert_produces_warning( expected_warning=com.SettingWithCopyWarning): df.loc[0]['A'] = 111
Example #7
Source File: test_chaining_and_caching.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_detect_chained_assignment_warnings(self): # warnings with option_context('chained_assignment', 'warn'): df = DataFrame({'A': ['aaa', 'bbb', 'ccc'], 'B': [1, 2, 3]}) with tm.assert_produces_warning( expected_warning=com.SettingWithCopyWarning): df.loc[0]['A'] = 111