Skip to content Skip to sidebar Skip to footer

Concatenating Dataframes By Index/columns Elements

import pandas as pd import numpy as np df = pd.DataFrame(data = np.random.random(36).reshape((9,4)), index = np.arange(1, np.random.random(36).reshape((9,4)).shape[0]+1), columns=

Solution 1:

Use pandas.DataFrame.merge:

pd.merge(df, te, left_index=True, right_on='Number_test')

or

pd.merge(df.reset_index(), te, left_on='index', right_on='Number_test')

Post a Comment for "Concatenating Dataframes By Index/columns Elements"