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

Type conversion error in to_flowdataframe destination #267

Open
cadentj opened this issue Jul 8, 2023 · 0 comments
Open

Type conversion error in to_flowdataframe destination #267

cadentj opened this issue Jul 8, 2023 · 0 comments

Comments

@cadentj
Copy link

cadentj commented Jul 8, 2023

When converting with a custom tessellation (not from the tiler module), FlowDataFrame init raises the following:

ValueError                                Traceback (most recent call last)
Cell In[68], line 1
----> 1 fdf = skmob.FlowDataFrame(data=flow, tessellation=tessellation)

File [~/Programming/scikit-mobility/skmob/core/flowdataframe.py:153](https://file+.vscode-resource.vscode-cdn.net/home/caden/Programming/qwang-research/working/data_sourcing/~/Programming/scikit-mobility/skmob/core/flowdataframe.py:153), in FlowDataFrame.__init__(self, data, origin, destination, flow, datetime, tile_id, timestamp, tessellation, parameters)
    149 destination = self[constants.DESTINATION]
    151 if not all(origin.isin(self._tessellation[constants.TILE_ID])) or \
    152         not all(destination.isin(self._tessellation[constants.TILE_ID])):
--> 153     raise ValueError("Inconsistency - origin and destination IDs must be present in the tessellation.")
    155 # Cleaning the index to make sure it is incremental
    156 self._tessellation.reset_index(inplace=True, drop=True)

ValueError: Inconsistency - origin and destination IDs must be present in the tessellation.

Error was resolved by forking library and extracting flows and tessellations before FlowDataFrame init. The destination column in flows was type 'float' while both origin and tile_ID were type 'int64'. Converting destination to type 'int64' and then initializing FlowDataFrame resovled the issue.

@cadentj cadentj closed this as completed Jul 8, 2023
@cadentj cadentj reopened this Jul 8, 2023
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

No branches or pull requests

1 participant