How to get the indices of a pandas DataFrame as a list or a NumPy array in the Python programming language. More details: https://statisticsglobe.com/convert-p...
R code of this video:
import pandas as pd # Import pandas library
data = pd.DataFrame({"x1":range(1, 10), # Create pandas DataFrame
"x2":["a", "b", "c", "d", "e", "d", "c", "b", "a"],
"x3":range(10, 1, - 1)})
print(data) # Print pandas DataFrame
data_index1 = data.index.tolist() # Extract as list object
print(data_index1) # Print index as list
data_index2 = data.index.values # Extract as NumPy array
print(data_index2) # Print index as NumPy array
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – Group for Discussions & Questions: / statisticsglobe
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – Group for Discussions & Questions: / 12555223
Twitter: / joachimschork
Music by bensound.com
En esta página del sitio puede ver el video en línea Convert pandas DataFrame Index to List & NumPy Array in Python (2 Examples) | Extract Data Indices de Duración hora minuto segunda en buena calidad , que subió el usuario Statistics Globe 11 abril 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 879 veces y le gustó 22 a los espectadores. Disfruta viendo!