Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Arturo Acosta](https://secure.gravatar.com/avatar/742c14fa693da68fb0dec7edeacef360?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Arturo Acosta
7,638 PointsI'm playing around with accessing methods and i realised something
1) So first we know we can access a full column by it's name as the notebook says on the third and fourth cells. 2) Then we can access a full row by label such as the 7th and 8th cell explain. So far so good. 3) We see in the 9th and 10th cell that we can also access a full row by its numeric index using iloc[index].
The question is, i am trying to access a full column by index, i tried iat[], which is stated in the pandas dataframe docs but it won't allow it, i would also need a row index to acces a single value and not the full column. Is there anyway we can acces a full column by index just like we did with iloc, that doesn't involve transposing or changing the dataframe format?
1 Answer
![Jeff Muday](https://uploads.teamtreehouse.com/production/profile-photos/5900142/micro_jeff_face.jpg)
Jeff Muday
Treehouse Moderator 28,718 PointsI am not a huge fan of the "ugly" syntax, but suppose you wanted to get the column with index 0
dataframe.iloc[ : , 0]
see the example
import pandas as pd
dataframe = pd.read_csv("https://people.sc.fsu.edu/~jburkardt/data/csv/mlb_teams_2012.csv")
print("======== show the head =============")
print(dataframe.head())
print("======== print Team column =========")
print(dataframe['Team'])
# team is in the zero-th column
col_index = 0
print("========== print column index 0================")
print(dataframe.iloc[ : ,col_index])
Arturo Acosta
7,638 PointsArturo Acosta
7,638 PointsThanks, I recall trying something like that but i might've had a mistake in the syntax,