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

Propose adding a get_l2data_table method to L2cache #213

Open
bdpedigo opened this issue Aug 27, 2024 · 1 comment
Open

Propose adding a get_l2data_table method to L2cache #213

bdpedigo opened this issue Aug 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bdpedigo
Copy link
Collaborator

(naming of the method completely up for debate)

I almost always do something like the following when I'm grabbing level2 cache data:

def _format_l2_data(level2_data: dict) -> pd.DataFrame:
    level2_data = pd.DataFrame(level2_data).T
    level2_data["x"] = level2_data["rep_coord_nm"].apply(
        lambda x: x[0] if x is not None else None
    )
    level2_data["y"] = level2_data["rep_coord_nm"].apply(
        lambda x: x[1] if x is not None else None
    )
    level2_data["z"] = level2_data["rep_coord_nm"].apply(
        lambda x: x[2] if x is not None else None
    )
    level2_data.index.name = "level2_id"
    level2_data.index = level2_data.index.astype(int)
    return level2_data

I wonder if having a separate method for doing this in CAVEclient, which just calls get_l2data, would be of interest to anyone else? Could also implement it as an alternative return type

@bdpedigo bdpedigo added the enhancement New feature or request label Aug 27, 2024
@bdpedigo
Copy link
Collaborator Author

of course might also want to unwrap some of the other columns in there, potentially

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

No branches or pull requests

1 participant