| 803 | |
| 804 | |
| 805 | def test_concatenate_unknown_axes(): |
| 806 | pd = pytest.importorskip("pandas") |
| 807 | dd = pytest.importorskip("dask.dataframe") |
| 808 | |
| 809 | a_df = pd.DataFrame({"x": np.arange(12)}) |
| 810 | b_df = pd.DataFrame({"y": np.arange(12) * 10}) |
| 811 | |
| 812 | a_ddf = dd.from_pandas(a_df, sort=False, npartitions=3) |
| 813 | b_ddf = dd.from_pandas(b_df, sort=False, npartitions=3) |
| 814 | |
| 815 | a_x = a_ddf.values |
| 816 | b_x = b_ddf.values |
| 817 | |
| 818 | assert np.isnan(a_x.shape[0]) |
| 819 | assert np.isnan(b_x.shape[0]) |
| 820 | |
| 821 | da.concatenate([a_x, b_x], axis=0) # works fine |
| 822 | |
| 823 | with pytest.raises(ValueError) as exc_info: |
| 824 | da.concatenate([a_x, b_x], axis=1) # unknown chunks |
| 825 | |
| 826 | assert "nan" in str(exc_info.value) |
| 827 | assert "allow_unknown_chunksize" in str(exc_info.value) |
| 828 | |
| 829 | c_x = da.concatenate( |
| 830 | [a_x, b_x], axis=1, allow_unknown_chunksizes=True |
| 831 | ) # unknown chunks |
| 832 | |
| 833 | assert_eq(c_x, np.concatenate([a_df.values, b_df.values], axis=1)) |
| 834 | |
| 835 | |
| 836 | def test_concatenate_flatten(): |