MCPcopy Create free account
hub / github.com/dask/dask / test_combine_first

Function test_combine_first

dask/dataframe/tests/test_dataframe.py:1850–1876  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1848
1849
1850def test_combine_first():
1851 df1 = pd.DataFrame(
1852 {
1853 "A": np.random.choice([1.0, 2.0, np.nan], 100),
1854 "B": np.random.choice(["a", "b", "nan"], 100),
1855 }
1856 )
1857
1858 df2 = pd.DataFrame(
1859 {
1860 "A": np.random.choice([1.0, 2.0, 3.0], 100),
1861 "B": np.random.choice(["a", "b", "c"], 100),
1862 }
1863 )
1864 ddf1 = dd.from_pandas(df1, 4)
1865 ddf2 = dd.from_pandas(df2, 5)
1866
1867 # DataFrame
1868 assert_eq(ddf1.combine_first(ddf2), df1.combine_first(df2))
1869 assert_eq(ddf1.combine_first(df2), df1.combine_first(df2))
1870
1871 # Series
1872 assert_eq(ddf1.A.combine_first(ddf2.A), df1.A.combine_first(df2.A))
1873 assert_eq(ddf1.A.combine_first(df2.A), df1.A.combine_first(df2.A))
1874
1875 assert_eq(ddf1.B.combine_first(ddf2.B), df1.B.combine_first(df2.B))
1876 assert_eq(ddf1.B.combine_first(df2.B), df1.B.combine_first(df2.B))
1877
1878
1879# This will likely break when the deprecation is enacted in Pandas 3.0

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
choiceMethod · 0.45
combine_firstMethod · 0.45

Tested by

no test coverage detected