“Jak ustawić indeksowe pandy” Kod odpowiedzi

Jak ustawić indeksowe pandy

# assignment copy
df = df.set_index('month')

# or inplace
df.set_index('month', inplace=True)

#      year   sale  month            month  year   sale
#  0   2012   55    1                1      2012   55
#  1   2014   40    4       =>       4      2014   40
#  2   2013   84    7                7      2013   84
#  3   2014   31    10               10     2014   31
FaceToThePalm

Ustaw indeks w danych danych

df = df.set_index('col')
Real Rook

Jak zmienić indeks w Pythonie DataFrame

index = [1,2]
df.index = index
Bewildered Barracuda

Indeks zestawu pand

>>> college_idx = college.set_index('instnm')>>> sats = college_idx[['satmtmid', 'satvrmid']].dropna()>>> sats.head()
Uninterested Unicorn

Ustaw indeks pandy

Pandas dataframe set-index()
Harish Vasanth

Odpowiedzi podobne do “Jak ustawić indeksowe pandy”

Pytania podobne do “Jak ustawić indeksowe pandy”

Więcej pokrewnych odpowiedzi na “Jak ustawić indeksowe pandy” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu