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.
Under which of the following circumstances may the Securities Transaction Tax arise?
1. Profits are made on a certain security
2. Compa...
An optical device Y has a positive focal length. Y is:
Match List-1 (Beach Resort) with List-II (State) and select the correct answer using the codes given below the Lists:
What is the minimum number of members required to apply for the registration of a trade union under Section 4 of the Trade Union Act, 1926?
What is the overtime rate for workers employed in agriculture mentioned under the act of minimum wages act 1948?
The most famous Chera ruler was
A shopkeeper sells glasses at the rate of Rs. 40 each and earns a commission of 18%. He also sells vases at the rate of Rs. 80 each and earns a commiss...
What was the achievement of Dobereiner’s triads?
The refractive index of air is :
Identify the correct chemical reaction involved in bleaching powder preparation