Skip to content

Conversation

@charlesdong1991
Copy link
Contributor

I was trying to create a MultiIndex from an array just now, and found out it hadnt been implemented, so have this PR to create MI from arrays.

>>> arrays = [['a', 'a', 'b', 'b'], ['red', 'blue', 'red', 'blue']]
>>> ks.MultiIndex.from_arrays(arrays)
MultiIndex([('a',  'red'),
                    ('a', 'blue'),
                    ('b',  'red'),
                    ('b', 'blue')],
                   names=['number', 'color'])

@itholic
Copy link
Contributor

itholic commented Nov 4, 2019

ks..MultiIndex.from_arrays(arrays, names=('number', 'color'))

2144

2145 ^

2146

2147SyntaxError: invalid syntax

2148

2149/home/travis/build/databricks/koalas/databricks/koalas/indexes.py:595: 

Maybe here is the problem ?

ks.. -> ks. 😄

@charlesdong1991
Copy link
Contributor Author

hahaha, yeah, my bad. I didn't check carefully and then went to bed because i was too sleepy yesterday. @itholic

@itholic
Copy link
Contributor

itholic commented Nov 5, 2019

haha. yeah that is also happening to me often. 😄

@codecov-io
Copy link

codecov-io commented Nov 5, 2019

Codecov Report

Merging #1001 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1001      +/-   ##
==========================================
+ Coverage   94.79%   94.79%   +<.01%     
==========================================
  Files          34       34              
  Lines        6572     6575       +3     
==========================================
+ Hits         6230     6233       +3     
  Misses        342      342
Impacted Files Coverage Δ
databricks/koalas/indexes.py 96.41% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23dc764...f5e6d3f. Read the comment docs.

@ueshin
Copy link
Collaborator

ueshin commented Nov 5, 2019

@charlesdong1991 Shall we keep the example in the first commit with doctest: +SKIP?
Otherwise, LGTM.

@charlesdong1991
Copy link
Contributor Author

oh, okay 😅

--------
>>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
>>> ks..MultiIndex.from_arrays(arrays, names=('number', 'color')) # doctest: +SKIP
Copy link
Collaborator

@ueshin ueshin Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry, please fix ks.Multi. 😄
also nit: style. need 2 spaces before #.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, god, sorry 😅

Copy link
Collaborator

@ueshin ueshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending tests.

@softagram-bot
Copy link

Softagram Impact Report for pull/1001 (head commit: f5e6d3f)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

@ueshin
Copy link
Collaborator

ueshin commented Nov 5, 2019

Thanks! merging.

@ueshin ueshin merged commit 29c18da into databricks:master Nov 5, 2019
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.

5 participants