473,398 Members | 2,404 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,398 software developers and data experts.

Put the data in a data structure (list, dict, etc.) using python

3 2Bits
I dont even know where to start.

https://corgis-edu.github.io/corgis/...electricity.py

https://corgis-edu.github.io/corgis/...ectricity.data

Expand|Select|Wrap|Line Numbers
  1. import electricity
  2. utility = electricity.get_utility()
I am having trouble organizing the dataset into a matrix of some sort with the columns : "number" "name" "state" "type"
Dec 15 '20 #1
1 13129
Vanisha
25 16bit
Sure, here are some examples of how to put data into different data structures using Python:

List:
A list is a collection of items that are ordered and changeable. Here's an example of how to create a list and add some data to it:
my_list = [1, 2, 3, "four", 5.0]
Dictionary:
A dictionary is a collection of key-value pairs that are unordered and changeable. Here's an example of how to create a dictionary and add some data to it:
my_dict = {"name": "John", "age": 30, "city": "New York"}
Tuple:
A tuple is a collection of items that are ordered and unchangeable. Here's an example of how to create a tuple:
my_tuple = (1, 2, 3, "four", 5.0)
A set is a collection of unique items that are unordered and unchangeable. Here's an example of how to create a set:
my_set = {1, 2, 3, "four", 5.0}
Note: You can add data to a list, dictionary, or set using the append() method, update() method, and add() method, respectively.
If you want to learn more, join CETPA Infotech.
Mar 22 '23 #2

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

Similar topics

5
by: Peter | last post by:
I am looking for a data structure that I need to use as follows. Suppose I am looking for node A. When I perform a lookup for node A I also want information about the node previous to node A( as...
3
by: Sigmathaar | last post by:
Hi, I'm need some advice about lists and vectors. I'm doing a program who needs to have sequential access of a non ordered unit of objects whose size decreases almost each time the sequence is...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
10
by: azrael | last post by:
Hy, i am a student and in 2 days I am writing a test in data structures and algorithms. I've done my homework and understood all the implementations and structures. My profesor was so kind to allow...
1
by: manitmalik | last post by:
Hi, I am a fresher and being assigned a work in which i need a help . Actually i have been told to write a script in python which can get the current price of stocks going on in the market on the...
4
navanova
by: navanova | last post by:
Hi Guys, I want to know how to retreive data from sql server 2000 and show them in a Checked List Box in vb.net using a data access class. Thanks
2
by: krislak | last post by:
about linked list using c
53
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming...
10
by: Hongtian | last post by:
Hi friends, I am a newer of Python. I want to ask below question: I have a C/C++ application and I want to use Python as its extension. To do that, I have to transfer some data structure from...
10
by: pikkukoira | last post by:
Good day. I have series of data in cvs file like below, 1,,, 1,137.1,1198,1.6 2,159,300,0.4 3,176,253,0.3 4,197,231,0.3 5,198,525,0.7
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.