row

Python Pandas, Running Sum, based on previous rows value and grouped

Python Pandas, Running Sum, based on previous rows value and grouped Question: I have a pandas dataframe along these lines, based on where a customer service case sits before being closed. Every time the case is edited and audit trial is captured. I want to generate a counter for each time the Department of a …

Total answers: 1

Extracting/deleting rows from time series without using index information

Extracting/deleting rows from time series without using index information Question: I have a simple problem. I want to get a subset of time series with a certain condition that is not dependent on time index. I have a very huge dataset, I am just giving a small example to make my problem understandable. row_num marks …

Total answers: 1

Remove Automatic Page Breaks in Openpyxl

Remove Automatic Page Breaks in Openpyxl Question: I am using openpyxl in Python to write to a worksheet. I need to add page breaks to specific rows. I am able to successfully add those row breaks using this block of code: page_break_rows = [44, 90, 135, 180, 226, 262] for row in page_break_rows: self.new_sheet.row_breaks.append(Break(id=row)) However, …

Total answers: 3

how to duplicate each row of a matrix N times Numpy

how to duplicate each row of a matrix N times Numpy Question: I have a matrix with these dimensions (150,2) and I want to duplicate each row N times. I show what I mean with an example. Input: a = [[2, 3], [5, 6], [7, 9]] suppose N= 3, I want this output: [[2 3] …

Total answers: 3

Add empty row with index in a Pandas dataframe

Add empty row with index in a Pandas dataframe Question: In all the examples and answers on here that I’ve seen, if there is the need to add an empty row ina Pandas dataframe, all use: ignore_index=True What should I do if i want to leave the current index, and append an empty row to …

Total answers: 2

How to convert list to row dataframe with Pandas

How to convert list to row dataframe with Pandas Question: I have a list of items like this: A = [‘1’, ‘d’, ‘p’, ‘bab’, ”] My goal is to convert such list into a dataframe of 1 row and 5 columns. If I type pd.DataFrame(A) I get 5 rows and 1 column. What should I …

Total answers: 2

Remove rows in python less than a certain value

Remove rows in python less than a certain value Question: I feel like this question must have been answered by someone before, but I can’t find an answer on stack overflow! I have a dataframe result that looks like this and I want to remove all the values less than or equal to 10 >>> …

Total answers: 4

Merge multiple column values into one column in python pandas

Merge multiple column values into one column in python pandas Question: I have a pandas data frame like this: Column1 Column2 Column3 Column4 Column5 0 a 1 2 3 4 1 a 3 4 5 2 b 6 7 8 3 c 7 7 What I want to do now is getting a new dataframe …

Total answers: 4