Skip to content

Conversation

@xinrong-meng
Copy link
Contributor

No description provided.

index_map[i], index_map[j], = index_map[j], index_map[i]
result = DataFrame(self._kdf._internal.copy(index_map=OrderedDict(index_map))).index
return result
return result # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise, Mypy expects "Index" as the return type.

index_map = OrderedDict(zip(sdf.columns, names))
internal = InternalFrame(spark_frame=sdf, index_map=index_map)
return DataFrame(internal).index
return DataFrame(internal).index # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise, Mypy expects "Index" as the return type.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, so maybe it seems that mypy requires us to add a kind of abstract methods to the Index class ?

Maybe can we ignore that rule like we did for inplace parameter ?? 😲

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @itholic, this is a good idea!

Unfortunately, I didn't find a parameter in https://mypy.readthedocs.io/en/stable/config_file.html can ignore this rule.

I do agree this should a common problem for other projects. Let me do more search and see if there is a better solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, Sure :)

@codecov-io
Copy link

codecov-io commented Nov 2, 2020

Codecov Report

Merging #1882 into master will decrease coverage by 2.88%.
The diff coverage is 96.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1882      +/-   ##
==========================================
- Coverage   94.20%   91.31%   -2.89%     
==========================================
  Files          40       40              
  Lines        9915     9833      -82     
==========================================
- Hits         9340     8979     -361     
- Misses        575      854     +279     
Impacted Files Coverage Δ
databricks/koalas/indexes.py 95.04% <96.20%> (-2.02%) ⬇️
databricks/koalas/usage_logging/__init__.py 25.66% <0.00%> (-66.65%) ⬇️
databricks/koalas/usage_logging/usage_logger.py 47.82% <0.00%> (-52.18%) ⬇️
databricks/koalas/__init__.py 76.66% <0.00%> (-13.34%) ⬇️
databricks/conftest.py 88.13% <0.00%> (-11.87%) ⬇️
databricks/koalas/spark/functions.py 88.88% <0.00%> (-7.41%) ⬇️
databricks/koalas/accessors.py 86.13% <0.00%> (-6.94%) ⬇️
databricks/koalas/namespace.py 78.08% <0.00%> (-4.93%) ⬇️
databricks/koalas/generic.py 90.56% <0.00%> (-4.79%) ⬇️
databricks/koalas/frame.py 93.40% <0.00%> (-3.33%) ⬇️
... and 14 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 bb22748...dfd76ca. Read the comment docs.

Copy link
Contributor

@itholic itholic left a comment

Choose a reason for hiding this comment

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

Seems fine to me except one question

return isinstance(self.spark.data_type, IntegralType)

def item(self):
def item(self) -> Union[Scalar, Tuple]:
Copy link
Member

Choose a reason for hiding this comment

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

Actually using Scalar is strictly not correct because this can return a pandas instance too. For exmaple, pd.Timestamp which is not in the Scalar from my cursory reading. But I think it's okay - we can fix it later separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. How about we define a pandas Scalar separately? @HyukjinKwon

@HyukjinKwon
Copy link
Member

Looks pretty good

@xinrong-meng xinrong-meng merged commit 19c3653 into databricks:master Nov 3, 2020
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