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

fixed issue parsing numpy array of times when writing irregular ts #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

klarrieu
Copy link

@klarrieu klarrieu commented Aug 2, 2024

When writing an irregular time series, there is a check to make sure that times exists as is either an instance of list or tuple. However, while numpy arrays work fine for regular time series, it fails for irregular time series. In this PR I amended the problematic code to also accept numpy arrays when writing irregular time series. This check fails in its current form when given numpy arrays both because if not times is ambiguous for an array and isinstance(times, (list, tuple)) evaluates to False, so I changed if not times to if times is None (less ambiguous) and I allowed times to be an instance of a numpy.ndarray for irregular time series as well.

@gyanz
Copy link
Owner

gyanz commented Aug 7, 2024

@klarrieu Can you modify the code to check if the length of the time container (array, list, or tuple) is not zero? len function should work for all types of containers.

@klarrieu
Copy link
Author

klarrieu commented Aug 7, 2024

Thanks for taking a look at this! I agree that is a good call. I adjusted the code for this PR accordingly.

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.

2 participants