Skip to content

Test Pandas Series is writeable #3995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions distributed/protocol/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

from dask.dataframe.utils import assert_eq

from distributed.protocol import serialize, deserialize, decompress
from distributed.protocol import (
serialize,
deserialize,
decompress,
dumps,
loads,
to_serialize,
)


dfs = [
Expand Down Expand Up @@ -63,10 +70,19 @@


@pytest.mark.parametrize("df", dfs)
def test_dumps_serialize_numpy(df):
def test_dumps_serialize_pandas(df):
header, frames = serialize(df)
if "compression" in header:
frames = decompress(header, frames)
df2 = deserialize(header, frames)

assert_eq(df, df2)


def test_dumps_pandas_writable():
a1 = np.arange(1000)
a1.flags.writeable = False
s1 = pd.Series(a1)
(s2,) = loads(dumps([to_serialize(s1)]))
assert (s1 == s2).all()
s2[...] = 0