Skip to content

Tag: dataframe

Python dataframe columns from row&column header

I have a data frame df1 like this: I want to make another df with separate col for each df1 col. header-row name pair: Basically I have used the pandas.DataFrame.describe function and now I would like to transpose it this way. Answer You can unstack your DataFrame into a Series, flatten the Index, turn it bac…

ValueError: All arrays must be of the same length

can someone help with the error with converting a json file to a data frame pls I’m trying to convert the JSON text file to a data frame but get the array same length error. I have tried double [[]] around the ‘data’ but still doesn’t work. The text file is at https://stackoverflowtez.…

how to detect a braking process in python dataframe

I have some trips, and for each trip contains different steps, the data frame looks like following: I want to know if, on a trip X, the cyclist has braked (speed has decreased by at least 30%). The problem is that the duration between every two steps is each time different. For example, in 6 seconds, the spee…