Additional methods and fixes to DataFrameMixin#43
Merged
Conversation
- create set_cells at DiscreteSpaceDF level
- created concrete swap in SpaceDF - update due to changes in mixin
- add remaining capacity property - branching _update_capacity in cells and agents
- added some useful method (add, all, div, drop_columns, drop_duplicates, group_by_cum_count, mul, norm, reset_index, set_index, srs_to_df) - minor fixes
- fixes to the logic of some methods
…nts are already present, the second if agents aren't already present - Fixes to the logic of some methods of SpaceDF (random_agents, swap_agents), DiscreteSpaceDF (__repr__, __str__) GridDF (__init__, get_directions, get_distances, get_neighbors, get_neighborhood, get_cells, out_of_bounds, remove_agents, torus_adj, _compute_offsets, _get_df_coords)
…act DataFrameMixin
- added custom _empty_cell_condition - fixed the logic of some methods (_generate_empty_grid, _sample_cells, _update_capacity_agents, remaining_capacity)
… 34-concrete-gridpandas
… 34-concrete-gridpandas
… 34-concrete-gridpandas
Merged
rht
approved these changes
Aug 1, 2024
Contributor
|
Tangent: it seems to me it could be its useful own package for a general DF with either pandas or Polars backend. Useful for people who can't decide which one to use, like us, haha. Otherwise, to add a selling point, we could implement R's dplyr-style grammar of data manipulation. Though there is already https://github.com/machow/siuba. |
Member
Author
|
Agree! A separate package with a unique interface for any DF library could be worthwile, especially since there are methods which are almost the same with only a name change. However right now I wrote up just the methods I needed so far. We can think about it when the library is a bit more mature. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds some useful methods to DataFrameMixin and fixes the logic of some methods in pandas and polars.
Added methods: