Q. Give two identical dataframes Sales16 and Sales17. But Sales17 has some values missing. Write code so that Sales17 fills its missing values from the corresponding entries of Sales16.
Answer =
import pandas as pd import numpy as np sales16 = pd.DataFrame( data = [531, 35, 27, 93, \ 30, 40, 5, 81, 51, 14, 59, 96], columns = \ [ 'closingPrice' ] ) sales17 = pd.DataFrame( data = [531, 35, 27, 93, \ np.nan, 40, 5, np.nan, 51, 14, 59, 96 ], columns = \ [ 'closingPrice' ] ) print( sales17.fillna(sales16) )
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )