-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Port's set method does not handle length robustly #32
Comments
Perhaps the solution is to create the dataframe, measure its length, then generate and add the index. This should work robustly with any valid source of data for a dataframe. |
Hi Jonathan, As you noticed, the Your solution would work, but we need to refactor this method anyway: the For now, if you really want to use a dictionary, you can generate the index yourself, and simply do something like: There are several strategies you can use to generate the index:
It really depends of what you need in terms of precision for your project. If you are OK with some potential artificial jitter, you can of course continue to use the |
Hi Pierre, thanks for your detailed answer. I had found the problem easy to work round as you suggested. I think the 'set' name led me into into thinking this was a recommended/preferred way of setting the data on the port. |
Great! Let me know if I can help further. You can also join the Slack channel for general support. |
In io.py we have:
This
set
method seems obviously designed to create a timestamp index for each row of the provided data.It works if the provided rows argument is a numpy array, but not if it's a dictionary. Obviously this is because the length of a dict is determined by the number of keys, not by the length of items within the dict.
Probably this should also use the time_range helper method from clock.py
The text was updated successfully, but these errors were encountered: