DimensionMismatch("column length of 178 for columns startTime, startLoc, routePlaned, and is incompatible with column length 177 for columns dists and travelTimes" in julia dataframes)

Hi. I was trying to use a dataframe with several columns, where some columns are vectors of varying length;
i.e., in some columns, they are of length say 10, and in some other columns, they are of length say 12. Also, in the same row, some entries may have different lengths, compared with other entries. Then I got this DimensionMismatch error. Could anyone let me know what might be wrong?

Can you post a slice of the dataframe? Might be easier to see the issue then.

If your columns are supposed to be of different length then you probably won’t be able to use a data frame. Data frames are assumed to be “rectangular”, with all columns the same length. You may be able to fill in rows with missing or nothing as appropriate so that the columns are the same length.

3 Likes

Thank you a lot for kind explanations.

So, if the columns are of different lengths, which data structure would be better than Data Frames ?

I figured it out now, by writing it directly to a .csv file instead.