wearable_stress_classification icon indicating copy to clipboard operation
wearable_stress_classification copied to clipboard

TypeError: 'NoneType' object is not subscriptable

Open italha91 opened this issue 5 years ago • 7 comments

When I ran This section: selected_x_columns = ['HR','interval in seconds','AVNN', 'RMSSD', 'pNN50', 'TP', 'ULF', 'VLF', 'LF', 'HF','LF_HF'] X = dataframe_hrv[selected_x_columns] y = dataframe_hrv['stress'] I get this error: X = dataframe_hrv[selected_x_columns] TypeError: 'NoneType' object is not subscriptable

italha91 avatar Apr 23 '19 15:04 italha91

I have the same issue.. did any one k now how to remove NoneType object is not subscripted error??

abidJeelani avatar Apr 25 '19 01:04 abidJeelani

Sorry for my late reply, I haven't see this before now! The Notebook is running fine for me and I'm not able to repoduce the error. Generally the Nonetype error occurs when there is an empty list, are both of you able to load the data in the previous steps?

Screenshot 2019-05-10 at 18 58 59

chriotte avatar May 10 '19 18:05 chriotte

I have updated the Notebook with some example output, please do a pull

chriotte avatar May 10 '19 18:05 chriotte

for any reason df=df.fillna(df.mean(),inplace=True) doesn't work on my computer (ubuntu 18.04, python 3.6.7 and pandas version pandas (0.25.0) I had to do this: df['HR'].fillna((df['HR'].mean()), inplace=True) df['HR'] = signal.medfilt(df['HR'],13) df['AVNN'].fillna((df['AVNN'].mean()), inplace=True) df['pNN50'].fillna((df['pNN50'].mean()), inplace=True) df['RMSSD'].fillna((df['RMSSD'].mean()), inplace=True) df['SDNN'].fillna((df['SDNN'].mean()), inplace=True) df['TP'].fillna((df['TP'].mean()), inplace=True) df['ULF'].fillna((df['ULF'].mean()), inplace=True) df['VLF'].fillna((df['VLF'].mean()), inplace=True) df['LF'].fillna((df['LF'].mean()), inplace=True) df['HF'].fillna((df['HF'].mean()), inplace=True) df['LF_HF'].fillna((df['LF_HF'].mean()), inplace=True)

pdeman avatar Aug 07 '19 07:08 pdeman

Hi, I tried to resolve the error by using pdeman's solution but no luck. I am still acing this issue, can anyone help me ? I am doing this on google colab

FarzadAvari avatar Oct 19 '19 09:10 FarzadAvari

I faced this same issue of 'NoneType' object is not subscriptable. Any idea on how to fix it?

TrinaDutta95 avatar Feb 09 '21 16:02 TrinaDutta95

Just Replace following line df=df.fillna(df.mean(),inplace=True)

with df.fillna(df.mean(),inplace=True)

it will resolve this issue...

atulwadkar27 avatar May 14 '21 11:05 atulwadkar27