"""
Example of using Panda
"""
from pandas import DataFrame
d=DataFrame(index=[(i,j) for i in range(1,7) for j in range (1,7)], columns=['sm','d1', 'd2', 'pd1', 'pd2', 'p'])
d.d1=[i[0] for i in d.index]
d.d2=[i[1] for i in d.index]
d.sm = map(sum, d.index)
d.head(20)
Ich bin ein Anfänger in Pandas, und ich versuche, eine Spalte Summe von Tupeln zu schaffen, aber das ist, was ich bekommen:Hinzufügen Tupel Indizes für Python Panda
sm d1 d2
(1,1) < Kartenobjekt bei 0x7f ... 7438> | 1 | 1 |
(1,2) < Kartenobjekt bei 0x7f ... 7438> | 1 | 2 |
(1,3) < Kartenobjekt bei 0x7f ... 7438> | 1 | 3 |
(1,4) < Kartenobjekt bei 0x7f ... 7438> | 1 | 4 |
(1,5) < Kartenobjekt bei 0x7f ... 7438> | 1 | 5 |
Ich verwende die Kartenfunktion falsch? Ist das python3-Problem? Danke im Voraus.
YES. ich danke dir sehr! – MoneyBall
@MoneyBall, Sie sind willkommen :) – MaxU