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

leaflet map popups #416

Open
MunsakaPKM opened this issue Apr 20, 2024 · 5 comments
Open

leaflet map popups #416

MunsakaPKM opened this issue Apr 20, 2024 · 5 comments
Assignees
Labels

Comments

@MunsakaPKM
Copy link

Greetings, I'm struggling to understand the add_to_link_popup and add_to_node_popup parameters, and need some guidance. I quoted part of the documentation below where it talks about adding popups. Despite multiple attempts, I'm encountering errors. Could someone please help, I'm particularly looking for an example of the expected DataFrame structure. I've been getting errors, including <class 'pandas.core.frame.DataFrame'> and Exception: 'Series' object has no attribute 'iteritems', which is confusing since I'm not passing a Series. Any clarification would be greatly appreciated

" add_to_node_popup : None or pd.DataFrame, optional
To add additional information to the node popup, use a DataFrame with
node name as index and attributes as values. Column names will be added
to the popup along with each value for a given node.

add_to_link_popup : None or pd.DataFrame, optional
    To add additional information to the link popup, use a DataFrame with 
    link name as index and attributes as values.  Column names will be added
    to the popup along with each value for a given link."
@kbonney
Copy link
Collaborator

kbonney commented Apr 22, 2024

This error occurs because we are using deprecated API for pandas Series objects as described on this pandas documentation page.

The simple fix is to use the correct method items for a series rather than iteritems. @MunsakaPKM, if you are interested in contributing to WNTR please feel welcome to create a PR to address this.

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Apr 24, 2024 via email

@kbonney
Copy link
Collaborator

kbonney commented Apr 24, 2024

Sure, here are some steps to help get you started:

  1. Create a fork of WNTR and clone it locally.
  2. Install WNTR following the developer instructions , except instead of using USEPA's WNTR, use the WNTR from your fork. I recommend installing to a fresh python environment.
  3. Make the changes we discussed to the code on a new branch. You can test these changes by running pytest wntr, but they will also be automatically tested when you create the pull request.
  4. Commit these changes and push the branch to your fork.
  5. Make a PR for your new branch. Fill out the template that we provide.
    Once you done that we can look at the next steps.

@kbonney
Copy link
Collaborator

kbonney commented Apr 24, 2024

Since this bug is not showing up in our current test suite, there should also be an update to the tests to make sure this code is covered properly. I wouldn't worry about this in your PR @MunsakaPKM, I can take care of it on the side.

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Apr 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants