I asked this question previously, and Frank answered it here. Original question:
I would like to count islands along rows in a .csv. I say "islands" meaning consecutive non-blank entries on rows of the .csv. If there are three non-blank entries in a row, I would like that to be counted as 1 island. Anything less than three consecutive entries in a row counts as 1 "non-island". I would then like to write the output to a dataframe:
I slightly changed the input .csv to now include multiple islands/gaps, such that rows were not simply an either "island" row or "non-island" row. Does anyone have any advice?
Input .csv:
Name,,,,,,,,,,,,,
Michael,,,1,1,1,,,,1,,,,
Peter,,,,1,1,,,,,,,,,
John,,,,,1,,,,,,,,,
Erin,,,,,1,1,,,,1,1,,,
Desired dataframe output:
Name,island,nonisland,
Michael,1,1,
Peter,0,1,
John,0,1,
Erin,0,2