Python Forum
Trouble with converting list , dict to int values!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with converting list , dict to int values!
#1
Hello guys
good day

I have a list of 4 points with x values:
[{'X': 2593.75}, {'X': 2457.42}, {'X': 2593.75}, {'X': 2457.42}] <class 'list'>

for example x(1) is:
{'X': 2457.42} <class 'dict'>

Now I need to calculate for example difference between x(1) and x(2) values:
diff = abs (x(1)-(2))

but i receive an error:
unsupported operand type(s) for -: 'dict' and 'int'

Would you please help me how to fix this problem? How can I get X integer values?
Thanks in advance for your help!
Reply


Messages In This Thread
Trouble with converting list , dict to int values! - by faryad13 - Sep-03-2020, 11:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting column of values into muliple columns of counts highland44 0 269 Feb-01-2024, 12:48 AM
Last Post: highland44
  Copying the order of another list with identical values gohanhango 7 1,184 Nov-29-2023, 09:17 PM
Last Post: Pedroski55
  Search Excel File with a list of values huzzug 4 1,283 Nov-03-2023, 05:35 PM
Last Post: huzzug
  trouble reading string/module from excel as a list popular_dog 0 437 Oct-04-2023, 01:07 PM
Last Post: popular_dog
  Comparing List values to get indexes Edward_ 7 1,205 Jun-09-2023, 04:57 PM
Last Post: deanhystad
  Adding values with reduce() function from the list of tuples kinimod 10 2,729 Jan-24-2023, 08:22 AM
Last Post: perfringo
  user input values into list of lists tauros73 3 1,085 Dec-29-2022, 05:54 PM
Last Post: deanhystad
  Membership test for an element in a list that is a dict value for a particular key? Mark17 2 1,233 Jul-01-2022, 10:52 PM
Last Post: Pedroski55
  Are list/dict comprehensions interpreted really sequentially? anata2047 3 1,470 May-31-2022, 08:43 PM
Last Post: Gribouillis
  dict class override: how access parent values? Andrey 1 1,665 Mar-06-2022, 10:49 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020