Linked Questions
17 questions linked to/from Normalize data in pandas
1716 votes
44 answers
2.4m views
Replacements for switch statement in Python?
I want to write a function in Python that returns different fixed values based on the value of an input index. In other languages I would use a switch or case statement, but Python does not appear ...
17 votes
4 answers
54k views
Faster way to remove outliers by group in large pandas DataFrame [duplicate]
I have a relatively large DataFrame object (about a million rows, hundreds of columns), and I'd like to clip outliers in each column by group. By "clip outliers for each column by group" I mean - ...
7 votes
1 answer
7k views
Ignore string columns while doing
I am using the following code to normalize a pandas DataFrame: df_norm = (df - df.mean()) / (df.max() - df.min()) This works fine when all columns are numeric. However, now I have some string columns ...
2 votes
2 answers
6k views
Python Pandas Dataframe: Normalize data between 0.01 and 0.99?
I am trying to bound every value in a dataframe between 0.01 and 0.99 I have successfully normalised the data between 0 and 1 using: .apply(lambda x: (x - x.min()) / (x.max() - x.min())) as follows: ...
3 votes
1 answer
7k views
Normalize column: sum to 1 [duplicate]
I have a dataframe: Time Weight 1 4 2 2 3 1 4 7 How can I normalize the weight column, so that the sum of the values in the weight column are equal to 1 ?
3 votes
1 answer
7k views
Scikit-learn's GridSearchCV with linear kernel svm takes too long
I took sample code from sklearn website, which is tuned_parameters = [{'kernel': ['rbf'], 'gamma': [1e-3, 1e-4], 'C': [1, 10, 100, 1000]}, {'kernel': ['linear'], 'C': [1, 10, 100, 1000]}] ...
1 vote
1 answer
7k views
Normalize data in pandas dataframe
I would like to normalise this value in the range of 0 to 100. I have these values in a pandas dataframe. Latitude Longitude 25.436596 -100.887300 25.436596 -100.887700 25....
3 votes
2 answers
4k views
How to scale a numpy array from 0 to 1 with overshoot? [duplicate]
I am trying to scale a pandas or numpy array from 0 to a unknown max value with the defined number replaced with 1. One solution I tried is just dividing the defined number I want by the array. test ...
1 vote
2 answers
4k views
Python Dataframe: normalize a numerical column using lambda
I tried to use the following code to normalize a column in python data frame: df['x_norm'] = df.apply(lambda x: (x['X'] - x['X'].mean()) / (x['X'].max() - x['X'].min()),axis=1) but got the following ...
2 votes
2 answers
3k views
Normalization of data
I have a code to normalise data imported from xls. which is a s follows import numpy as np Xt, Tt = XLSImport('AI_sample.xlsx') # calculate the maximum values valX1_max = np.max((Xt)[0]) valX2_max = ...
0 votes
2 answers
4k views
Single pcolormesh with more than one colormap using Matplotlib
I'm creating a GUI where there is live 'point in time' data for several records ("things") and fields. records are comparable based on field, but fields are not necessarily related (at least not on ...
-1 votes
1 answer
2k views
Normalizing .csv labelled file using pandas in python
I was normalizing the .csv (labelled) and i was following the answer given on this link: Normalize data in pandas So, my question is how do i preserve labels and normalize the data. csv file: ...
0 votes
1 answer
743 views
How to standardize matrix row-wise (axis=1)?
For a two-dimensional array, I'm trying to make a standardize-function, which should work row-wise and column-wise. I'm not sure what to do when an argument is given with axis=1 (row-wise). def ...
0 votes
1 answer
364 views
Normalize data on multi-index table using pandas
I have a dataframe O D counts 0 G1 G1 8576 1 G1 G2 4213 2 G1 G3 8762 3 G2 G1 8476 4 G2 G2 2134 ... But each of the groups have different populations in O and D. ...
0 votes
0 answers
432 views
TensorFlow loss returns NaN
I'm trying to write my first simple neural net with my own data based on various tutorials and information. I'm stuck at the point where I think I prepared the model and I'm trying to run it, but when ...