Answers for "r drop na in df"

6

r remove na from dataset

new_df <- na.omit(df, c("myvar1", "myvar2")) # Remove NA on specific variables
Posted by: Guest on June-19-2020
0

drop_na in pandas

# importing pandas module
import pandas as pd
  
# making data frame from csv file
data = pd.read_csv("nba.csv")
  
# making new data frame with dropped NA values
new_data = data.dropna(axis = 0, how ='any')
  
Posted by: Guest on June-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language