By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Access Data from a list inside the dictionary of lists

P: 1
I made a dictionary using passenger Id's given in data as keys and then it contains all the details given:

from collections import defaultdict
Passenger=defaultdict(list)
for points in Data['PassengerId']:
ID=points
Passenger[ID].append(data.loc[points])
Passenger[0]
output:
[PassengerId 1
Survived 0
Pclass 3
Name Braund, Mr. Owen Harris
Sex male
Age 22
SibSp 1
Parch 0
Ticket A/5 21171
Fare 7.25
Cabin NaN
Embarked S

How can i access age from this list? or may be some other item from the list?
Jul 4 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.