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

[BUG] Tutorial 35: ValueError: Cannot subset columns with a tuple with more than one element. #301

Closed
huisky2000 opened this issue Sep 7, 2023 · 7 comments

Comments

@huisky2000
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

  1. https://gemgis.readthedocs.io/en/latest/getting_started/tutorial/35_plotting_borehole_data_with_pyvista.html
  2. Follow the steps as described.
  3. I got an error on step 12 (all steps before this are fine).
    labels = gg.visualization.create_borehole_labels(df=data)
    labels
  4. see below:

ValueError Traceback (most recent call last)
Cell In[12], line 1
----> 1 labels = gg.visualization.create_borehole_labels(df=data)
2 labels

File ~\Anaconda3\envs\gemgis\lib\site-packages\gemgis\visualization.py:2375, in create_borehole_labels(df)
2370 raise ValueError('X, Y and Altitude columns must be provided for label creation')
2372 # Creating array with coordinates from each group (equals to one borehole)
2373 coordinates = np.rot90(
2374 np.array(
-> 2375 df.groupby(['Index', 'Name'])['X', 'Y', 'Altitude'].apply(lambda x: list(np.unique(x))).values.tolist()),
2376 2)
2378 # Creating borehole location PyVista PolyData Object
2379 borehole_locations = pv.PolyData(coordinates)

File ~\Anaconda3\envs\gemgis\lib\site-packages\pandas\core\groupby\generic.py:1767, in DataFrameGroupBy.getitem(self, key)
1763 # per GH 23566
1764 if isinstance(key, tuple) and len(key) > 1:
1765 # if len == 1, then it becomes a SeriesGroupBy and this is actually
1766 # valid syntax, so don't raise
-> 1767 raise ValueError(
1768 "Cannot subset columns with a tuple with more than one element. "
1769 "Use a list instead."
1770 )
1771 return super().getitem(key)

ValueError: Cannot subset columns with a tuple with more than one element. Use a list instead.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [win10]
  • Browser [e.g. Microsoft edge Version 116.0.1938.62 (Official build) (64-bit)]
  • Version [e.g. 116.0.1938.62]

Additional context
Add any other context about the problem here.

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Hello and welcome! Thanks for posting your first issue in the GemGIS project! Someone from our developers will get back to you. If your question is support related, we may transfer it to the Discussions.

@AlexanderJuestel
Copy link
Collaborator

@huisky2000 thanks for reporting this. I will have a look at it!

@AlexanderJuestel
Copy link
Collaborator

Dear @huisky2000,

I was able to fix the Issue. It was a ValueError caused by pandas>2.0.0, see https://stackoverflow.com/questions/76158147/pandas-groupby-valueerror-cannot-subset-columns-with-a-tuple-with-more-than-o

The bug is fixed in 902a9ea and will be published with GemGIS 1.1.1 very soon.

Thanks for finding this! I will keep it upon until the PR is merged.

@AlexanderJuestel AlexanderJuestel changed the title Tutorial 35 plot borehole error detected [BUG] Tutorial 35: ValueError: Cannot subset columns with a tuple with more than one element. Sep 7, 2023
@AlexanderJuestel AlexanderJuestel mentioned this issue Sep 7, 2023
6 tasks
@huisky2000
Copy link
Author

Ok, thanks. The next question is how can i make the installation for GEMGIS 1.1.1?

@AlexanderJuestel
Copy link
Collaborator

AlexanderJuestel commented Sep 11, 2023

@huisky2000 I have not released GemGIS 1.1.1 yet. Once it is released, you can install it by using pip install gemgis

@huisky2000
Copy link
Author

@huisky2000 I have not released GemGIS 1.1.1 yet. Once it is released, you can install it by using pip install gemgis

Ok, any workaround for now?

@AlexanderJuestel
Copy link
Collaborator

@huisky2000 I have released GemGIS 1.1.1 and 1.1.2 just today. However, as we are currently changing the deployment process, you would have to pull the repo from Github to get the latest features

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

No branches or pull requests

2 participants