473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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=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
0 959

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

Similar topics

7
by: Bart Nessux | last post by:
I understand how a Python list can be broken into smaller lists by using slice like this: new_small_list_1 = BIG_LIST #0-1000 new_small_list_2 = BIG_LIST #1001-2000 new_small_list_3 =...
0
by: Steve Perry | last post by:
I have a serialized list and dictionary stored in a file, with the following format: mydata: color origin datasource1 {server:"server1.domain" username:"client" password:"secret"} Is...
7
by: Chris Ritchey | last post by:
Hmmm I might scare people away from this one just by the title, or draw people in with a chalange :) I'm writting this program in c++, however I'm using char* instead of the string class, I am...
2
by: | last post by:
Hi I'm trying to have a drop down list inside a repeater where the data for the list is extracted from a database along with other items but I can't seem to get it to work for the list. My...
0
by: JB | last post by:
Hi All, I was wondering if there was an easy and straightforward way to bind elements in a ListView control, with the corresponding elements in a List or Dictionary. Ideally I'd like a...
2
by: aspineux | last post by:
Hello I just want to update the data inside List or Dictionary without adding or deleting object. is this correct ? l= for i, v in enumerate(l): l=v+1
7
ADezii
by: ADezii | last post by:
There are essentially three techniques for publishing Access Data on the Web. The first technique is static, and does not allow for the dynamic addition or modification to the data, There is no...
1
by: Simon Brunning | last post by:
2008/8/26 ajak_yahoo <arazak73@yahoo.com.my>: Well, that's a really bad data structure for what you want to do, but you can do it with something like (untested): wanted = 'AE00207' for part...
5
by: =?Utf-8?B?THVpZ2k=?= | last post by:
Hi all, having a List<stringand Dictionary<int, stringhow can I check that every string in the list is also in the Dictionary (and viceversa)? (and raise an exception when not). Thanks in...
3
by: suneelkn | last post by:
Unable to identify the same level for nested lists in all scenarios, when the nested-list inside an ordered list the conversion process executes with out proper list order for nested list items. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.