Код: Выделить всё
mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
{'a': 100, 'b': 200, 'c': 300, 'd': 400},
{'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000}]
df = pd.DataFrame(mydict)
print(df.iloc[[0][-1]].shape)
output(4,)
print(df.iloc[[0][0]].shape)
output(4,)
print(df.iloc[[0]].shape)
output(1, 4)
print(df.iloc[[0][1]].shape)
outputIndexError: list index out of range
print(type(df.iloc[[0]]))
output
print(type(df.iloc[[0][0]]))
output
Подробнее здесь: [url]https://stackoverflow.com/questions/78992288/parameter-problems-of-iloc-functions-in-pandas[/url]