Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BUG: GeoDataFrame.repeat return DataFrame #823

Closed
Zeroto521 opened this issue Dec 25, 2022 · 2 comments · Fixed by #824
Closed

BUG: GeoDataFrame.repeat return DataFrame #823

Zeroto521 opened this issue Dec 25, 2022 · 2 comments · Fixed by #824

Comments

@Zeroto521
Copy link
Owner

>>> import dtoolkit.geoaccessor
>>> import geopandas as gpd
>>> from shapely import Point
>>> df = (
...     gpd.GeoDataFrame(
...         {
...             "label": ["a", "b"],
...             "geometry": [Point(100, 1), Point(122, 55)],
...         },
...         crs=4326,
...     )
...     .repeat(2)
... )
>>> df
  label        geometry
0     a   POINT (100 1)
0     a   POINT (100 1)
1     b  POINT (122 55)
1     b  POINT (122 55)
>>> type(df)
<class 'pandas.core.frame.DataFrame'>
Zeroto521 added a commit that referenced this issue Dec 25, 2022
@Zeroto521
Copy link
Owner Author

some helpful methods may pass old df information to new df

  • ._constructor
  • .__finalize__

@Zeroto521
Copy link
Owner Author

Zeroto521 commented Dec 25, 2022

Other accessors may have this problem also.
If their return data via creating DataFrame or Series constructor

Zeroto521 added a commit that referenced this issue Dec 25, 2022
* Fix geodataframe.repeat return dataframe

* Simplify a bit

* fix #823

* Update exmaples

* Correct variable names

* lint codes
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant