Skip to content

Tag: pandas

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…

Excel VBA to Python code (Filter function)

I’m new to python. Some help would be great, thanks in advance too. I am trying to get the various average salary based on Units. In Excel, I would do =AVERAGE(FILTER(B:B,A:A=D3)). Where Column B is all the individual salaries and Column A is the various Unit. I have managed to do an array of the differ…

get intersection in single column of pandas dataframe

I have a dataframe like this: I want to add a new column ‘intersec’ and get the intersection of the Price column and its shift value. But when I use It doesn’t work, I get the following error: what should I do? My expected result is: Answer shift the price find intersect sample output

Combining weeks 52 and 0 with Python Datetime

I have a Pandas DataFrame with daily data that I’m trying to group by week number to sum some columns, and I notice that when years do not begin on Sunday, the data for the week spanning the end of one year and the beginning of the next do not cleanly sum, instead being broken into two groups. My code