transitland-processing-animation
transitland-processing-animation copied to clipboard
Problems with Cairo Metro (Value Error: broadcast input, copy sequence, set a frame)
Hi,
Thank you very much for this wonderful tool. I've been trying it with San Francisco BART Onestop ID and Chicago bounding box and it worked very well.
However, I am having issue when I try to create an animation of Cairo transit flows. While Cairo Metro has its own Onestop ID on Transitland Feed registry, it seems that it has never been sketched. Whether I use the Onestop ID or a bounding box, as shown below:
(Carte1) MacBook-Pro-de-moi-2:transitflow moi$ python transitflow.py --name=cai --operator=o-stq4-nationalauthorityfortunnels
INPUTS:
date: 2019-11-23
name: cai
API key: None
1 operators to be downloaded.
b'o-stq4-nationalauthorityfortunnels' 1 / 1
http://transit.land/api/v1/routes?operated_by=o-stq4-nationalauthorityfortunnels&per_page=10000
3 routes found.
(Carte1) MacBook-Pro-de-moi-2:transitflow moi$ python transitflow.py --name=Cairo2 --bbox=30.799484,29.819200,31.678391,30.205674 --clip_to_bbox
INPUTS:date: 2019-11-23
name: Cairo2
API key: None
bbox: 30.799484 29.819200 31.678391 30.205674
http://transit.land/api/v1/operators?bbox=30.799484%2C29.819200%2C31.678391%2C30.205674&per_page=10000
8 operators in bounding box.
8 operators to be downloaded.
b'o-stq4-nationalauthorityfortunnels' 1 / 8
http://transit.land/api/v1/routes?operated_by=o-stq4-nationalauthorityfortunnels&per_page=10000
3 routes found.
...it always gives me the same three Value errors, as shown here:
success!
8 operators successfully downloaded.
0 operators failed.
Concatenating individual operator outputs.
Calculating trip segment bearings.
Traceback (most recent call last):
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/common.py", line 377, in _asarray_tuplesafe
result[:] = values
ValueError: could not broadcast input array from shape (0,8) into shape (0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/frame.py", line 2376, in _ensure_valid_index
value = Series(value)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/series.py", line 248, in __init__
raise_cast_failure=True)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/series.py", line 3029, in _sanitize_array
subarr = _asarray_tuplesafe(data, dtype=dtype)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/common.py", line 380, in _asarray_tuplesafe
result[:] = [tuple(x) for x in values]
ValueError: cannot copy sequence with size 8 to array axis with dimension 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "transitflow.py", line 406, in <module>
df['bearing'] = df.apply(lambda row: calc_bearing_between_points(row['start_lat'], row['start_lon'], row['end_lat'], row['end_lon']), axis=1)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/frame.py", line 2331, in __setitem__
self._set_item(key, value)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/frame.py", line 2396, in _set_item
self._ensure_valid_index(value)
File "/Users/moi/opt/anaconda3/envs/Carte1/lib/python3.6/site-packages/pandas/core/frame.py", line 2378, in _ensure_valid_index
raise ValueError('Cannot set a frame with no defined index '
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series
Thank you very much for your help and, again, for this tool. Cheers!