BUG: concatenation of dups across dtypes fails for axis=0 · Issue #4771 · pandas-dev/pandas (original) (raw)

Addmitedly an odd case....

In [5]: df = concat([DataFrame(np.random.randn(10,4),columns=['A','A','B','B']),
   ...:                      DataFrame(np.random.randint(0,10,size=20).reshape(10,2),columns=['A','C'])],
   ...:                     axis=1)

In [6]: df
Out[6]: 
          A         A         B         B  A  C
0 -0.931048  1.068066 -0.006521 -0.031878  4  7
1  2.440559  1.279710 -0.272613 -1.387456  8  4
2 -0.220729  0.730665 -0.999338 -1.063784  1  1
3 -0.395295 -0.868506 -1.945702  1.531287  4  1
4  0.218480 -1.907875  0.354556 -0.277721  9  3
5 -0.518193 -1.292118 -0.250087  0.750773  3  8
6  1.908601 -1.736724 -1.156278  0.552929  3  7
7 -0.996528  0.081386 -1.030960  0.959769  7  1
8  0.349220  0.904122 -0.033104 -1.469096  1  4
9  0.798829 -0.882321 -1.969144 -0.237184  4  7

In [7]: concat([df,df],axis=1)
Out[7]: 
          A         A         B         B  A  C         A         A         B         B  A  C
0 -0.931048  1.068066 -0.006521 -0.031878  4  7 -0.931048  1.068066 -0.006521 -0.031878  4  7
1  2.440559  1.279710 -0.272613 -1.387456  8  4  2.440559  1.279710 -0.272613 -1.387456  8  4
2 -0.220729  0.730665 -0.999338 -1.063784  1  1 -0.220729  0.730665 -0.999338 -1.063784  1  1
3 -0.395295 -0.868506 -1.945702  1.531287  4  1 -0.395295 -0.868506 -1.945702  1.531287  4  1
4  0.218480 -1.907875  0.354556 -0.277721  9  3  0.218480 -1.907875  0.354556 -0.277721  9  3
5 -0.518193 -1.292118 -0.250087  0.750773  3  8 -0.518193 -1.292118 -0.250087  0.750773  3  8
6  1.908601 -1.736724 -1.156278  0.552929  3  7  1.908601 -1.736724 -1.156278  0.552929  3  7
7 -0.996528  0.081386 -1.030960  0.959769  7  1 -0.996528  0.081386 -1.030960  0.959769  7  1
8  0.349220  0.904122 -0.033104 -1.469096  1  4  0.349220  0.904122 -0.033104 -1.469096  1  4
9  0.798829 -0.882321 -1.969144 -0.237184  4  7  0.798829 -0.882321 -1.969144 -0.237184  4  7

In [8]: concat([df,df],axis=0)
AttributeError: 'BlockManager' object has no attribute 'dtype'