Skip to content

trajectory_evaluation.ipynb breaks #19

Description

@singhish

When I reach the cell:

spatial_errors_df = pd.DataFrame()
spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_la)], axis="index")
spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_sj)], axis="index")
spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_ucb)], axis="index")

I get the following output:

No ground truth route for suburb_city_driving_weekend walk_start, must be polygon, skipping...
Processing travel leg android, ucb-sdb-android-1, accuracy_control, suburb_city_driving_weekend, suburb_city_driving_weekend
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-21-8958a15239da> in <module>
      1 spatial_errors_df = pd.DataFrame()
----> 2 spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_la)], axis="index")
      3 spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_sj)], axis="index")
      4 spatial_errors_df = pd.concat([spatial_errors_df, get_spatial_errors(pv_ucb)], axis="index")

<ipython-input-20-26623ce778ff> in get_spatial_errors(pv)
     34                         meter_dist = filtered_us_gpdf.geometry.distance(filtered_gt_linestring)
     35                         ne = len(meter_dist)
---> 36                         curr_spatial_error_df = gpd.GeoDataFrame({"error": meter_dist,
     37                                                                   "ts": section_geo_df.ts,
     38                                                                   "geometry": section_geo_df.geometry,

~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/geopandas/geodataframe.py in __init__(self, *args, **kwargs)
     59         crs = kwargs.pop("crs", None)
     60         geometry = kwargs.pop("geometry", None)
---> 61         super(GeoDataFrame, self).__init__(*args, **kwargs)
     62 
     63         # need to set this before calling self['geometry'], because

~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy)
    433             )
    434         elif isinstance(data, dict):
--> 435             mgr = init_dict(data, index, columns, dtype=dtype)
    436         elif isinstance(data, ma.MaskedArray):
    437             import numpy.ma.mrecords as mrecords

~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/pandas/core/internals/construction.py in init_dict(data, index, columns, dtype)
    252             arr if not is_datetime64tz_dtype(arr) else arr.copy() for arr in arrays
    253         ]
--> 254     return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
    255 
    256 

~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/pandas/core/internals/construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype)
     62     # figure out the index, if necessary
     63     if index is None:
---> 64         index = extract_index(arrays)
     65     else:
     66         index = ensure_index(index)

~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/pandas/core/internals/construction.py in extract_index(data)
    376                         f"length {len(index)}"
    377                     )
--> 378                     raise ValueError(msg)
    379             else:
    380                 index = ibase.default_index(lengths[0])

ValueError: array length 180 does not match index length 259

Any ideas?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions