1
Greetings! I have two dataframes. Both have columns that determine intervals, with maximum and minimum numbers. In each dataframe the classification of each range is done in one way. I wanted to make a new column in the second dataframe with the classification according to the classification made in the first.
for example:
import pandas as pd
import numpy as np
var1 = 'df1.csv'
var2 = 'df2.csv'
df1 = pd.read_csv(var1, sep=';')
df2 = pd.read_csv(var2, sep=';')
print(df1)
Topo Base CLASSIFICADOR_1
0 10 A
11 22 B
23 37 C
print(df2)
Topo Base ClASSIFICADOR_2
0 2 T
3 5 N
6 10 T
11 14 P
15 22 U
23 33 N
34 37 P
The result I’d like is basically this:
Topo Base CLASSIFICADOR_2 CLASSIFICADOR_1
0 2 T A
3 5 N A
6 10 T A
11 14 P B
15 22 U B
23 33 N C
34 37 P C
thanks! I got it here, thank you very much! abs
– Pedro