'Pandas dropna function is returning original dataframe despite me setting a threshold. How may I resolve this?

Not sure why dropna() isn't working... 'data' is a preset pandas dataframe with 5 named columns with all values like integers or NA Part of my project is to ask the user to input their own threshold by the way

threshold = input("What is your threshold for NAs in a given row?")
try:
   num = int(threshold)
except:
   print("Please enter a number or leave blank")
   if num < 0:
      print("Please enter a positive integer")
   elif num >= 0:
      data = data.dropna(axis = 0, thresh=num, inplace=True)
      print(data)
                
return data

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source