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

Use iloc to make sure it retrieves the first element. #2037

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Feb 2, 2021

Use iloc in infer_pd_series_spark_type to make sure it retrieves the first element.

Before:

>>> infer_pd_series_spark_type(pd.Series(['a','b','c'], index=[10,20,30]))
Traceback (most recent call last):
...
KeyError: 0

After:

>>> infer_pd_series_spark_type(pd.Series(['a','b','c'], index=[10,20,30]))
StringType

Note that currently the function in only called from InternalFrame.from_pandas which always resets index before calling it.

@ueshin ueshin requested a review from HyukjinKwon February 2, 2021 23:13
@codecov-io
Copy link

codecov-io commented Feb 2, 2021

Codecov Report

Merging #2037 (9b8c3d7) into master (88212f3) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2037      +/-   ##
==========================================
- Coverage   94.64%   94.57%   -0.07%     
==========================================
  Files          54       54              
  Lines       11402    11294     -108     
==========================================
- Hits        10791    10681     -110     
- Misses        611      613       +2     
Impacted Files Coverage Δ
databricks/koalas/typedef/typehints.py 93.80% <100.00%> (ø)
databricks/koalas/__init__.py 86.56% <0.00%> (-4.48%) ⬇️
databricks/koalas/testing/utils.py 79.89% <0.00%> (-1.33%) ⬇️
databricks/koalas/generic.py 92.39% <0.00%> (-0.35%) ⬇️
databricks/koalas/plot/core.py 92.24% <0.00%> (-0.29%) ⬇️
databricks/koalas/namespace.py 84.17% <0.00%> (-0.24%) ⬇️
...ricks/koalas/tests/plot/test_series_plot_plotly.py 97.93% <0.00%> (-0.13%) ⬇️
databricks/koalas/mlflow.py 95.12% <0.00%> (-0.12%) ⬇️
databricks/koalas/indexing.py 92.53% <0.00%> (-0.10%) ⬇️
databricks/koalas/indexes/multi.py 95.72% <0.00%> (-0.08%) ⬇️
... and 16 more

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 88212f3...9b8c3d7. Read the comment docs.

@HyukjinKwon HyukjinKwon merged commit b664553 into databricks:master Feb 2, 2021
@ueshin ueshin deleted the infer_pd_series_spark_type branch February 3, 2021 00:03
@itholic
Copy link
Contributor

itholic commented Feb 3, 2021

Nice

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.

4 participants