PolicyEngine / microdf

Analysis tools for working with survey microdata as DataFrames.
http://pslmodels.github.io/microdf
MIT License
12 stars 10 forks source link

MicroDataFrame.merge() returns a DataFrame #194

Open MaxGhenis opened 3 years ago

MaxGhenis commented 3 years ago

Example:

d = mdf.MicroDataFrame(dict(g=["a", "a", "b"], y=[1, 2, 3]), weights=[4, 5, 6])
d2 = mdf.MicroDataFrame(dict(g=["a", "b"], z=[1, 2]), weights=[4, 5])
merged = d.merge(d2, on="g")
merged.__class__

pandas.core.frame.DataFrame

merged
    g   y   __tmp_weights   z
0   a   1   4.0 1
1   a   2   5.0 1
2   b   3   6.0 2

I think mdf1.merge(mdf2) should return a MicroDataFrame that preserves mdf1's weights.