The fillna() method in Pandas is used to replace NaN values in a DataFrame. By passing df.median() as an argument to fillna(), we can replace missing values with the median value of each column. This approach is especially useful when missing values are suspected to deviate from the mean due to outliers, making median imputation a more robust choice. The Pandas fillna() method is highly flexible and frequently used in data cleaning to handle missing data without discarding rows or losing valuable information in other columns. Option A (df.fillna(df.mean())) is incorrect as it fills NaNs with the mean rather than the median. Option B (df.replace(df.median())) is incorrect because replace() is not used directly for filling NaN values. Option D (df.dropna(inplace=True)) is incorrect as it removes rows with NaNs instead of filling them. Option E (df.interpolate(method="median")) is incorrect as interpolate() does not directly support median filling.
Which of the following products was the first from Nagaland to get GI TAG?
India's Credit-to-Deposit (C-D) ratio for 2023-24 increased to what percentage?
India's First Forest University to Come Up in which state?
Which of the following films has been awarded the Best Feature Film in the 68th National Film Awards?
According to the data provided by the government,which state has emerged as the largest buyer of goods and services among all states and Union Territori...
The Mahatma Gandhi National Rural Employment Guarantee Act (MGNREGA) ensures a minimum number of days of wage employment to every household in rural are...
The Productivity Linked Reward (PLR) Scheme has been modified by the Union Cabinet to benefit employees of Major Port Authorities and Dock Labour Boards...
Which region in Finland will host NATO’s new Multi Corps Land Component Command, expected to be operational in 2024?
Under PM Awas Yojana (Urban), what does the term “Beneficiary-led Individual House Construction” refer to?
Which of the following will offer a feature on its platform by the end of the year through which users will be able to discover catalogues of various re...