Python Forum
ValueError - Formatting issue when values enter thousands
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ValueError - Formatting issue when values enter thousands
#5
(Apr-20-2023, 11:17 AM)buran Wrote: Your string has thousands separator, so you need to strop that in order to convert to float:
total_cost += float(cell_value[1:].replace(',', ''))
That said, probably your code can be simplified

That worked! Much appreciated!

As you stated the code can be simplified, do you have any suggestions? I'm a novice user with Python and starting to find myself using this over PowerShell for Azure APIs.
Reply


Messages In This Thread
RE: ValueError - Formatting issue when values enter thousands - by phillyfa - Apr-20-2023, 06:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,242 May-17-2022, 11:38 AM
Last Post: Larz60+
  formatting float like int for whole values Skaperen 8 1,807 Apr-11-2022, 01:56 PM
Last Post: deanhystad
  ValueError: not enough values to unpack (expected 4, got 1) vlearner 2 6,387 Jan-28-2022, 06:36 PM
Last Post: deanhystad
  [SOLVED] [geopy] "ValueError: too many values to unpack (expected 2)" Winfried 2 2,902 Mar-30-2021, 07:01 PM
Last Post: Winfried
  ValueError: not enough values to unpack (expected 2, got 1) Wolfpack2605 1 12,709 Jan-27-2018, 11:52 AM
Last Post: buran
  Dictionary Comprehension - ValueError: too many values to unpack (expected 2) samRddhi 2 8,534 Dec-22-2017, 09:25 AM
Last Post: samRddhi
  valueError too many values to unpack iFunKtion 7 90,521 Apr-29-2017, 05:16 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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