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

Add ks.DataFrame.from_dict #1778

Merged
merged 4 commits into from
Sep 17, 2020
Merged

Add ks.DataFrame.from_dict #1778

merged 4 commits into from
Sep 17, 2020

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Sep 16, 2020

This PR proposes ks.DataFrame.from_dict.

Basically it just reuse the DataFrame constructor.

>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
>>> ks.DataFrame.from_dict(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d

@itholic
Copy link
Contributor Author

itholic commented Sep 16, 2020

Not sure if we should implemented parameter orient since It seems can easily occur the overhead.

>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data, orient="index")
       0  1  2  3
col_1  3  2  1  0
col_2  a  b  c  d

@ueshin
Copy link
Collaborator

ueshin commented Sep 17, 2020

Thanks! merging.

@ueshin ueshin merged commit 9b69568 into databricks:master Sep 17, 2020
@itholic itholic deleted the f_from_dict branch October 6, 2020 00:17
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 this pull request may close these issues.

3 participants