Start learning 50% faster. Sign in now
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.
Consider the statements about Devika Project:
1. It is North India’s first river rejuvenation project.
2. Built on the lines of ‘Namam...
The 'One Nation, One Election' initiative aims to align the elections for which two governmental bodies?
On which day is World Disability Day celebrated every year?
Who headed the Indian delegation at the 149th Assembly of the Inter-Parliamentary Union (IPU)?
What was the inflow of NRI deposits from April to July 2024, as reported by the RBI?
Which carrier rocket was used to launch China's new high-orbit internet services satellite, Weixing Hulianwan Gaogui-02, in August 2024?
Which Indian state introduced a 33% reservation for women in outsourced government jobs as of May 2024?
Which year did SEBI make BRSR mandatory for the top 1,000 listed entities by market capitalization?
Which state government recently approved the state's first-ever witness protection scheme to ensure the safety of witnesses during investigations and tr...
Which country/countries are the hosts of Asia Cup 2023 Cricket tournament?