trackintel
trackintel copied to clipboard
List of trip ids in a tour dataframe is unstructured when reading it from postgis.
Tours store a list of the trips they aggregate in the field "trips". Unfortunately the datatype of this list is not stable when writing+reading it from a postgis database. In this case it is transformed to a string of a dictionary, e.g., '{72066,72067,72068,72069,72070}'
It would be great if the trackintel reading/writing functions could somehow handle this. If there is no better way, the read tours from postgis function could include a line like this to parse the field properly:
tours["trips"] = tours["trips"].apply(lambda x: eval(x.replace("{", "[").replace("}", "]")))