ทางตำรวจ dataframe เปลี่ยนคอลัมน์ที่แอ็กทีฟ:

รหัสตัวอย่าง

16
0

N

# Basic syntax:
# Assign column names to a Pandas dataframe:
pandas_dataframe.columns = ['list', 'of', 'column', 'names']
# Note, the list of column names must equal the number of columns in the
# 	dataframe and order matters

# Rename specific column names of a Pandas dataframe:
pandas_dataframe.rename(columns={'column_name_to_change':'new_name'})
# Note, with this approach, you can specify just the names you want to
# 	change and the order doesn't matter

# For rows, use "index". E.g.:
pandas_dataframe.index = ['list', 'of', 'row', 'names']
pandas_dataframe.rename(index={'row_name_to_change':'new_name'})
4
0

N

df = df.rename(columns={"old_col1": "new_col1", "old_col2": "new_col2"})
3
0

N

df = df.rename(columns = {'myvar':'myvar_new'})
-1
0

N

df.columns = ['A','B']

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่