Jun-25-2018, 12:02 PM
Hi Gurus,
I am doing python course on datacamp and I have come across the below exercise.
row_data.dropna()[1:-1]
TIA
I am doing python course on datacamp and I have come across the below exercise.
def check_null_or_valid(row_data): """Function that takes a row of data, drops all missing values, and checks if all remaining values are greater than or equal to 0 """ no_na = row_data.dropna()[1:-1] numeric = pd.to_numeric(no_na) ge0 = numeric >= 0 return ge0 # Check whether the first column is 'Life expectancy' assert g1800s.columns[0] == 'Life expectancy' # Check whether the values in the row are valid assert g1800s.iloc[:, 1:].apply(check_null_or_valid, axis=1).all().all() # Check that there is only one instance of each country assert g1800s['Life expectancy'].value_counts()[0] == 1I would like to know what the following step does:
row_data.dropna()[1:-1]
TIA