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

Fix: Use np.concatenate() instead of np.array() for merging 1D arrays with different sizes #132

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

dabhicusp
Copy link
Collaborator

Currently, the usage of np.array() inside the _process_coordinate_data fails when attempting to merge 1D arrays with different sizes. This can be resolved by replacing np.array() with np.concatenate(), which effectively merges 1D arrays with varying shapes into a single 1D array.

Example code:

import numpy as np
day1 = np.random.randint(10, size=(5))
print(day1)

day2 = np.random.randint(10, size=(4))
print(day2)

allDays1 = np.array([day1, day2])  # not worked
allDays2 = np.concatenate([day1, day2]) # worked
print(allDays1)

Copy link
Collaborator

@mahrsee1997 mahrsee1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mahrsee1997 mahrsee1997 requested a review from naschmitz January 30, 2024 12:56
@copybara-service copybara-service bot merged commit 6700ed1 into google:main Feb 1, 2024
6 of 11 checks passed
@dabhicusp dabhicusp deleted the replace_np_array branch February 1, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants