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

Support string columns #21

Merged
merged 4 commits into from
Feb 21, 2025
Merged

Support string columns #21

merged 4 commits into from
Feb 21, 2025

Conversation

BradyAJohnston
Copy link
Collaborator

@BradyAJohnston BradyAJohnston commented Feb 20, 2025

Supports string columns, fixes #20

This now additionally imports string columns. It uses numpy.unique(data, return_inverse = True) which alphabetically sorts the strings and assigns them integer values starting at 0.

Strings aren't supported as fields / attributes, but we can use strings inside of the For Each Element zone, turning the field integer value into a single value.

To reliably access this data, a custom node group is created that contains an Index Switch node setup with the string values for that data type.

In the example test data, the resulting nodes would look like below.

CleanShot 2025-02-20 at 11 14 18@2x

Inside the created node group:

CleanShot 2025-02-20 at 11 11 39@2x

@BradyAJohnston BradyAJohnston linked an issue Feb 20, 2025 that may be closed by this pull request
@kolibril13
Copy link
Owner

kolibril13 commented Feb 20, 2025

Just had the chance to do some more testing, and it works great!
image

@kolibril13 kolibril13 merged commit 4b40769 into main Feb 21, 2025
12 checks passed
@kolibril13 kolibril13 deleted the string-iswitch branch February 21, 2025 07:50
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

Successfully merging this pull request may close these issues.

Generate Index Switch nodes for string attributes
2 participants