Install Python
Your first Experience! print()
Write Comments
Arithmetic Operators
Variables
Datatypes and type() Method
Uppercase or Lowercase Methods
Replace Method
Functions
Series and DataFrame
Combining DataFrames
Deleting rows and columns with missing values
Merging/Joining DataFrames
Replacing values in DataFrames
Creating new columns with Mapping function
Ordering columns
Dropping rows and columns
Summary Statistics
Search
Pandas - Part2 (Combining DataFrame)¶
Import NUMPY, PANDAS, Series & DataFrame¶
In [4]:
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
Creating DataFrame 1¶
In [9]:
# Creating DataFrame1
# We put np.nan in nan as it is easier to write nan than np.nan
nan=np.nan
#nan is a missing value in np.array([nan,2,5])
df1 = DataFrame ({ 'Category': (['Books', 'Computers', 'Home']), 'sales_Number': np.array([nan,3,5])})
df1
Out[9]:
Creating DataFrame 2¶
In [8]:
# Creating DataFrame2
# We put np.nan in nan as it is easier to write nan than np.nan
nan=np.nan
df2 = DataFrame ({ 'Category': (['Books', 'Computers', 'Home']), 'sales_Number': np.array([4,3,5])})
df2
Out[8]:
Combining two Dataframe:¶
df1.combine_first(df2)
In [10]:
df1.combine_first(df2)
Out[10]: