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

[FEATURE] Columnar data creation helper function #786

Closed
nitbharambe opened this issue Oct 15, 2024 · 4 comments · Fixed by #834
Closed

[FEATURE] Columnar data creation helper function #786

nitbharambe opened this issue Oct 15, 2024 · 4 comments · Fixed by #834
Labels
feature New feature or request

Comments

@nitbharambe
Copy link
Member

nitbharambe commented Oct 15, 2024

A initialize_column(data_type, component, shape, attributes, empty=False) helper function which gives out columnar data ie. dict of arrays.

Motivation:

We have initialize_array helper function to make users not bother about the dtype. A same one for columnar data.

If the user has to create a columnar data now, they would have to do :
{k: v for k,v in initialize_array(dataset_type, component_type, shape).items()}
or
{k: np.empty(shape=..., dtype=power_grid_meta_data[dataset_type][component_type][k]) for k in attributes}
or some similar combination

Also in first way, user creates a huge array; subset of which is then converted to dictionary.

Options:

initialize_column(data_type, component, shape, attribute, empty=False) -> np.ndarray

initialize_columnar_data(data_type, component, shape, attributes, empty=False) -> dict[str, np.ndarray]

@nitbharambe nitbharambe added the feature New feature or request label Oct 15, 2024
@mgovers
Copy link
Member

mgovers commented Oct 24, 2024

decision: use initialize_array(data_type, component, shape, empty=False, *, attributes=None) with additional kwarg

@petersalemink95
Copy link
Member

decision: use initialize_array(data_type, component, shape, empty=False, *, attributes=None) with additional kwarg

To be clear: attributes=None should refer to the row based initialization, that already is present. For columnar people should specify a "filter" in attributes=, similar as in the data filter

@nitbharambe
Copy link
Member Author

Update: This helper function would make assignment operations ambiguous for users. Hence it is now decided to have attribute_dtype(dataset_type, component_type, attribute) and attribtue_empty functions.

@Jerry-Jinfeng-Guo
Copy link
Contributor

@nitbharambe Is this still open?

@TonyXiang8787 TonyXiang8787 moved this to Q4 2024 in Power Grid Model Nov 21, 2024
@TonyXiang8787 TonyXiang8787 linked a pull request Nov 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Q4 2024
Development

Successfully merging a pull request may close this issue.

5 participants