Apply a multiplication to random elements on my dataframe [Solved]

So what I want is to randomly chose a given amount of elements on my dataframe, and to those elements, apply an operation (which will be a multiplication by a number which will also be randomly chosen between a range) to an ‘eta’ column. I’m stuck on achieving this. atm I’ve randomly gotten a list… Read More Apply a multiplication to random elements on my dataframe [Solved]

How to compare list items

I have a list with few items and I need to compare Consecutive items of them. e.g: ‘item_1’ ‘item_2’ ‘item_2’ ‘item_3’ ‘item_3’, ‘item_4’ ‘item_4’, ‘item_5’ ‘item_5’, ‘item_6’ ‘item_6’, ‘item_7’ I tried with some coding part like this. But it unsuccessfully ! my_list = [‘item_1’, ‘item_2’, ‘item_3’, ‘item_4’, ‘item_5’, ‘item_6’, ‘item_7’] for (a, b) in zip(my_list… Read More How to compare list items

Why does dropna not drop na?

From my understanding, dropna for pandas in python drops rows with an empty entry. import pandas as pd the_data = pd.read_csv("EnzymeTrainingData.csv") the_data.dropna(inplace = True) seqs = the_data["protein_sequence"] amino_numeros = seqs.apply(len) hands = amino_numeros.apply(lambda n : float(n*(n + 1))/2) the_pH = the_data["pH"] additive = 14 x_train = [] for i in range(len(the_pH)): print(i) print(the_pH[i]) But for… Read More Why does dropna not drop na?

Find the sum of squares for each cluster? in data using scale function and build the K-means

Consider the dataset “USArrests.csv”. This data set contains statistics, in arrests per 100,000 residents for assault, murder, and rape in each of the 50 US states in 1973. Also given is the percent of the population living in urban areas. Variables Description States:: The state where the incident occurred Murder: No. of arrests for murder… Read More Find the sum of squares for each cluster? in data using scale function and build the K-means