import numpy as np
import pandas as pd

# Create a list
list = [[1,2,3], [4,5,6], [7, np.nan, np.nan]]

df = pd.DataFrame(list)

print("Initial\n", df)

df = df.dropna()

print("\nAfter dropping rows\n", df)

















import numpy as np
import pandas as pd

# Create a list
list = [[1,2,3], [4,5,6], [7, np.nan, np.nan]]

df = pd.DataFrame(list)

print("Initial\n", df)

df = df.dropna(axis=1)

print("\nAfter dropping columns\n", df)











import numpy as np
import pandas as pd

# Create a list
list = [[1,2,3], [4,np.nan,6], [7, np.nan, np.nan]]

df = pd.DataFrame(list)

print("Initial\n", df)

df = df.dropna(thresh=2)

print("\nAfter dropping rows\n", df)















Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, April 30, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250