0

showing list of animals - each row represents a location

I want to loop through a 761,000 rows by 25 columns excel document, for the each row

  1. count columns with values>0 and store in a column called count
  2. for the values > 0, add them and store in a new column called animals_per_location
  3. return the names of the column title that has values greater than zero

sample output

jaraboy
  • 9
  • 1
  • 4
    what did you try ? can you post some code ? – Dadep Jul 24 '17 at 17:01
  • Could you also create a minimum input dataset and expected output from this minimum set. See [MVCE](https://stackoverflow.com/help/mcve). – Scott Boston Jul 24 '17 at 17:03
  • https://stackoverflow.com/questions/37428218/how-to-properly-apply-a-lambda-function-into-a-pandas-data-frame-column – Moritz Jul 24 '17 at 17:23
  • https://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.Series.apply.html – Moritz Jul 24 '17 at 17:23
  • actually, you do not have to loop over the rows. Take a look into 10 Minutes to pandas. This should be possible by logical indexing and very simple data manipulation https://pandas.pydata.org/pandas-docs/stable/10min.html – Moritz Jul 24 '17 at 17:41

0 Answers0