I want to know how I can iterate over all the testing data set and append the outcome in csv…
Iterating over test data set
hey @Varunsh_20 ,
you can iterate using a for loop over the test.csv file or more efficiently use a lambda function to iterate over all your data and get the final results.
** for lambda function , search for .apply function on pandas dataframe .
If you get any kind of problem or confusion , just reply back here.
Thank You.
Iterating through pandas dataFrame objects is generally slow. Iteration beats the whole purpose of using DataFrame. It is an anti-pattern and is something you should only do when you have exhausted every other option. It is better look for a List Comprehensions , vectorized solution or DataFrame.apply() method for iterating through DataFrame.
List comprehensions example
result = [(x, y,z) for x, y,z in zip(df['column1'], df['column2'],df['column3'])]