Description
The provided input file support_tickets/support_tickets.csv contains a malformed row that causes standard CSV parsers (Python csv module, pandas) to produce 29 rows instead of 30.
Root cause
Row 7's Issue field contains a trailing \n inside the quoted value:
"i can not able to see apply tab\n"
Per RFC 4180, a newline inside a quoted field is treated as part of the field value, not a record separator. As a result:
- Row 7's
Issue is parsed as "i can not able to see apply tab\n" (with trailing newline)
- The next physical line, the
Issue of ticket 8 ("I need to practice, submissions not working") is absorbed as row 7's Subject
- Ticket 8 is silently dropped
- All rows from index 8 onward are shifted by one field
Impact
Any solution that reads the CSV with a standard parser and outputs 30 rows is being penalised for non-compliance, when the compliant behaviour (correct RFC 4180 parsing) is what produces the 29-row result. Conversely, solutions that produce 30 rows either detect and repair the defect, or are applying workarounds that the challenge did not document as necessary.
Reproduction
import pandas as pd
df = pd.read_csv('support_tickets/support_tickets.csv')
print(len(df)) # prints 29, not 30
print(df.iloc[6]) # Subject column contains ticket 8's issue text
Suggested fix
Replace the malformed row in the CSV so that the Issue field does not contain an embedded newline. A corrected version of row 7 should be:
"i can not able to see apply tab","<original subject>","HackerRank"
Alternatively, document that participants are expected to detect and repair this defect as part of the challenge, and clarify whether the expected output is 29 or 30 rows.
Description
The provided input file
support_tickets/support_tickets.csvcontains a malformed row that causes standard CSV parsers (Pythoncsvmodule, pandas) to produce 29 rows instead of 30.Root cause
Row 7's
Issuefield contains a trailing\ninside the quoted value:Per RFC 4180, a newline inside a quoted field is treated as part of the field value, not a record separator. As a result:
Issueis parsed as"i can not able to see apply tab\n"(with trailing newline)Issueof ticket 8 ("I need to practice, submissions not working") is absorbed as row 7'sSubjectImpact
Any solution that reads the CSV with a standard parser and outputs 30 rows is being penalised for non-compliance, when the compliant behaviour (correct RFC 4180 parsing) is what produces the 29-row result. Conversely, solutions that produce 30 rows either detect and repair the defect, or are applying workarounds that the challenge did not document as necessary.
Reproduction
Suggested fix
Replace the malformed row in the CSV so that the
Issuefield does not contain an embedded newline. A corrected version of row 7 should be:Alternatively, document that participants are expected to detect and repair this defect as part of the challenge, and clarify whether the expected output is 29 or 30 rows.