Python Forum
Adding 2-column CSV together in base Python without using pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding 2-column CSV together in base Python without using pandas
#2
You need to check each value before you sum it, and if it's empty, treat it as zero. Something like:

auto_score = int(row['Auto Score']) if row['Auto Score'].strip() else 0
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Adding 2-column CSV together in base Python without using pandas - by ichabod801 - Sep-29-2019, 11:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding PD DataFrame column bsben 2 359 Mar-08-2024, 10:46 PM
Last Post: deanhystad
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 774 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  pandas : problem with conditional filling of a column Xigris 2 674 Jul-22-2023, 11:44 AM
Last Post: Xigris
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 877 Sep-08-2022, 06:32 AM
Last Post: klllmmm
  Basic Pandas, obtaining a value from column and row JamesOzone 2 1,118 Jun-30-2022, 07:16 PM
Last Post: jefsummers
  Reshaping a single column in to multiple column using Python sahar 7 2,124 Jun-20-2022, 12:35 PM
Last Post: deanhystad
  Float Slider - Affecting Values in Column 'Pandas' planckepoch86 0 1,432 Jan-22-2022, 02:18 PM
Last Post: planckepoch86
  pandas pivot table: How to find count for each group in Index and Column JaneTan 0 3,372 Oct-23-2021, 04:35 AM
Last Post: JaneTan
  Adding another condition for df column comparison Mark17 2 1,706 Sep-30-2021, 03:54 PM
Last Post: Mark17
  Python Pandas: How do I extract all the >1000 data from a certain column? JaneTan 0 1,589 Jul-17-2021, 09:09 AM
Last Post: JaneTan

Forum Jump:

User Panel Messages

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