Skip to content

Tag: dataframe

How to reverse a pandas series

I have a pandas series that must be flipped upside-down before I concatenate it to the main DataFrame. I can easily flip it with myseries = myseries.iloc[::-1] But when I attach it to the main DataFrame, it attaches the default series and not the flipped version. Why doesn’t the flipped series stay in p…

Appending row to dataframe with concat()

I have defined an empty data frame with and want to append rows in a for loop like this: But I get this error If I use df = df.append(row, ignore_index=True), it works but it seems that append is deprecated. So, I want to use concat(). How can I fix that? Answer You can transform your dict in pandas DataFrame