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

groupby casts string column to int #183

Closed
td7650 opened this issue Apr 23, 2021 · 0 comments · Fixed by #186
Closed

groupby casts string column to int #183

td7650 opened this issue Apr 23, 2021 · 0 comments · Fixed by #186

Comments

@td7650
Copy link

td7650 commented Apr 23, 2021

Describe the bug
Running the example code below results in wrong column type

To Reproduce
Steps to reproduce the behavior:

  1. Open the attached test.html in your browser
  2. or group a string column with numerical values like "2021-01" and count another column
var json_data = [
  { key: "P1", month: "2021-01", storypoints: 3 },
  { key: "P2", month: "2021-02", storypoints: 1 },
  { key: "P3", month: "2021-02", storypoints: 3 },
  { key: "P4", month: "2021-03", storypoints: 2 },
  { key: "P5", month: "2021-04", storypoints: 3 }
];
let df = new dfd.DataFrame(json_data);
df.plot("div1").table()

let grp = df.groupby(["month"]);
let new_df = grp.col(["key"]).count();
new_df.plot("div2").table()

Expected behavior

  1. column "month" in grouped dataframe should show values like "2021-01", "2021-02", ...
  2. instead the whole columns datatype is changed from string to int and it shows multiple entries of "2021", "2021"
  3. the month part after the "-" is cut off

Screenshots
test.zip - zipped test.html
code

ungrouped
grouped

Desktop (please complete the following information):

  • OS: Win 10
  • Browser chrome
  • Version 89.0.4389.128
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

Successfully merging a pull request may close this issue.

1 participant