rows

Checking that ALL rows have met a certain criteria in a dataframe using iLoc

Checking that ALL rows have met a certain criteria in a dataframe using iLoc Question: I need to make sure that ALL the rows have met a certain criteria not just some of them.. I have this code which returns TRUE when some of the rows meet the criteria.. Any idea how to only return …

Total answers: 1

percentage of cells to row total python

percentage of cells to row total python Question: hi I have a dataset that looks much like this data frame below: #Table1 : print("Table1: Current Table") data = [[‘ALFA’, 35, 47, 67, 44, 193], [‘Bravo’, 51, 52, 16, 8, 127], [‘Charlie’, 59, 75, 2, 14, 150], [‘Delta’, 59, 75, 2, 34, 170], [‘Echo’, 59, 75, …

Total answers: 3

Adding rows that are in the same quarter of dates

Adding rows that are in the same quarter of dates Question: I am currently working on python to add rows quarter by quarter. The dataframe that I’m working with looks like below: df = [[‘A’,’2021-03′,1,9,17,25], [‘A’,’2021-06′,2,10,18,26], [‘A’,’2021-09′,3,11,19,27], [‘A’,’2021-12′,4,12,20,28], [‘B’,’2021-03′,5,13,21,29], [‘B’,’2021-06′,6,14,22,30], [‘B’,’2022-03′,7,15,23,31], [‘B’,’2022-06′,8,16,24,32]] df_fin = pd.DataFrame(df, columns=[‘ID’,’Date’,’Value_1′,’Value_2′,’Value_3′,’Value_4′]) The Dataframe has ‘ID’, ‘Date’ column and three columns …

Total answers: 1

Shifting rows based on current column values in pandas

Shifting rows based on current column values in pandas Question: I’m trying to shift all rows that have an E in colB to be blank in colA and then the values of colA and colB shifted over 1. Everything I search on shift or adjusting has to do with moving columns up or down. I …

Total answers: 2

Deleting a row from a CSV based on line number and shifting all lines afterwards

Deleting a row from a CSV based on line number and shifting all lines afterwards Question: Let’s say I have this CSV: my friend hello, test ok, no whatever, test test test, ok I want to delete line number 3, so I would call my function: remove_from_csv(3) I couldn’t find any built-in remove function and …

Total answers: 3

Performing calculations in python using excel values

Performing calculations in python using excel values Question: I’m trying to do some calculations in python using an excel with several rows and using 3 columns. I’m using the columns ‘Band’ and ‘Antenna_Heigh’ and I would like to save these values in the column ‘Colors’. My code looks like this but I have an error …

Total answers: 2

How to enter new rows in a dataset by keeping same index

How to enter new rows in a dataset by keeping same index Question: I am trying to enter into the following dataset: data = [("Il nome della rosa","Umberto Eco", 1980), ("L’amore che ti meriti","Daria Bignardi", 2014), ("Memorie dal sottsuolo", " Fëdor Dostoevskij", 1864), ("Oblomov", "Ivan Alexandrovich Goncharov ", 1859)] index = range(1,5,1) data = pd.DataFrame(data, …

Total answers: 2

Devide Pandas dataframe into list of rows containing all columns

Devide Pandas dataframe into list of rows containing all columns Question: I need to devide Pandas dataframe into list of rows with all columns. That means that if there’s a dataframe with n rows and m columns I need to make a list of n elements and each element should be 1 x m row. …

Total answers: 1

adding rows with Nan values to Pandas DataFrame

adding rows with Nan values to Pandas DataFrame Question: I want to insert rows with Nan values after each row index values 0 44 1 50 2 51 3 66 4 23 DataFrame should look like this index values 0 44 1 Nan 2 50 3 Nan 4 51 5 Nan 6 66 7 Nan …

Total answers: 3