You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to merge a bunch of files in a loop. I realize there's a better way to do this and a workaround, but it took me a second to realize what was going on here.
w = pd.DataFrame(np.random.random((4,2)), columns=["x", "y"])
x = pd.DataFrame(np.random.random((4,2)), columns=["x", "y"])
y = pd.DataFrame(np.random.random((4,2)), columns=["x", "y"])
z = pd.DataFrame(np.random.random((4,2)), columns=["x", "y"])
dta = x.merge(y, left_index=True, right_index=True).merge(z, left_index=True, right_index=True, how="outer")
dta.merge(w, left_index=True, right_index=True)
The text was updated successfully, but these errors were encountered:
In [22]: concat([w,x,y,z],axis=1)
Out[22]:
x y x y x y x y
0 -0.563069 -0.961155 0.431668 0.878735 -0.388918 0.922276 -0.519004 0.801015
1 -1.562759 -0.273918 -1.019135 -1.245221 -0.428684 -1.153576 0.573085 1.766883
2 0.538920 -0.196340 0.947958 -1.089876 0.681975 -0.176980 0.572076 0.932001
3 -0.583187 0.041399 0.420735 -1.839026 -0.827691 -0.996057 -1.050309 -0.832534
or
In [23]: concat([w,x,y,z],keys=['w','x','y','z'],axis=1)
Out[23]:
w x y z
x y x y x y x y
0 -0.563069 -0.961155 0.431668 0.878735 -0.388918 0.922276 -0.519004 0.801015
1 -1.562759 -0.273918 -1.019135 -1.245221 -0.428684 -1.153576 0.573085 1.766883
2 0.538920 -0.196340 0.947958 -1.089876 0.681975 -0.176980 0.572076 0.932001
3 -0.583187 0.041399 0.420735 -1.839026 -0.827691 -0.996057 -1.050309 -0.832534
Yeah, that's nice. It won't work for me (I have a terrible situation) and ended up going a completely different route. Just found the error message to be pretty cryptic until I thought about it.
Trying to merge a bunch of files in a loop. I realize there's a better way to do this and a workaround, but it took me a second to realize what was going on here.
The text was updated successfully, but these errors were encountered: