“Pandy dodają listę do DataFrame jako kolumny” Kod odpowiedzi

Jak dodać listę do DataFrame w Python

to_append = [5, 6]
a_series = pd.Series(to_append, index = df.columns)
df = df.append(a_series, ignore_index=True)
Clumsy Cowfish

Pandy dodają kolumnę z listy

# creating a list for new column
places = ['Nellore', 'Mumbai', 'Andhra']

# we are using 'Places' as column name
# adding the list to the dataframe as column
dataframe['Places'] = places
Lala Lunatic

Pandy dodają listę do DataFrame jako kolumny

df[new_column] = the_list
Kwams

Odpowiedzi podobne do “Pandy dodają listę do DataFrame jako kolumny”

Pytania podobne do “Pandy dodają listę do DataFrame jako kolumny”

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

Przeglądaj inne języki kodu