Skip to content
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

Using @mutate with a Dictionary or array loses the column types #324

Open
pstaabp opened this issue Jan 23, 2021 · 1 comment
Open

Using @mutate with a Dictionary or array loses the column types #324

pstaabp opened this issue Jan 23, 2021 · 1 comment

Comments

@pstaabp
Copy link

pstaabp commented Jan 23, 2021

If one defines:

d=Dict(1=>"xx",2=>"yy",3=>"zz")
df = DataFrame(str=["a","b","c"],x=[1,2,3])

and then

df |> @mutate(y=d[_.x]) |> DataFrame

results in

Row │ str  x    y
     │ Any  Any  Any
─────┼───────────────
   1 │ a    1    xx
   2 │ b    2    yy
   3 │ c    3    zz

losing the types of all of the columns. And doing a little digging, this doesn't seem to be an issue with the dictionary. If instead

d=["xx","yy","zz"]

the above code loses the column types. In addition, if

d2=[7,8,9]

then

df |> @mutate(z=d2[_.x]) |> DataFrame

also loses the column types.

@danvinci
Copy link

danvinci commented Feb 2, 2021

Same here, seems the same issue as #313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants