Access Data from a list inside the dictionary of lists

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Krypton
    New Member
    • Jul 2016
    • 1

    Access Data from a list inside the dictionary of lists

    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=defau ltdict(list)
    for points in Data['PassengerId']:
    ID=points
    Passenger[ID].append(data.lo c[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?
Working...