Первый столбец Python DataFrame
import pandas as pd
# List of Tuples
empoyees = [('Jack', 34, 'Sydney', 5) ,
('Riti', 31, 'Delhi' , 7) ,
('Aadi', 16, 'London', 11) ,
('Mark', 41, 'Delhi' , 12)]
# Create a DataFrame object
df = pd.DataFrame( empoyees,
columns=['Name', 'Age', 'City', 'Experience'])
print("Contents of the Dataframe : ")
print(df)
# Select first column of the dataframe as a dataframe object
first_column = df.iloc[: , :1]
print("First Column Of Dataframe: ")
print(first_column)
print("Type: " , type(first_column))
# Select first column of the dataframe as a series
first_column = df.iloc[:, 0]
print("First Column Of Dataframe: ")
print(first_column)
print("Type: " , type(first_column))
Vast Vendace