No, when you iterate over a csvreader, each row is a list of strings, but when you iterate over a file, each row is just a string. Btw, the docs on csvreader says this.
Thanks for your explanation! It helps! I will look into this
yes... i have tried it out... when iterate over a csvreader, each row is a list of string, and each element is a string. but may i know why is it in a 2D list? is it because of my data contains a few columns?
Isn't this normal? A list of lists means you have a list where each item is a row and each row is a column
uhhh... I'm so confusing now... it shouldn't return just a 1D list instead?
No, refer to: https://t.me/c/1111136772/164038
Ya referred… Iterate over a csvreader, it will return me nested list and each row of data is a string within a list…
but when i iterate over a file, it will just returns me a list and each row of the data is 1 string plus \n
that's expected behaviour, what's the issue
Oh because I just want to clear my doubts… As my basic/foundation is not strong enough…
and yes it's because of the columns
Thank you… So I would said that if the data have multiple columns, eventually the output would be a nested list if iterate over a csvreader method
yes that's the point of using a CSV reader
Thank you for clearing my doubts… I need to ensure that my basic/foundation is strong enough, then only will proceed further
No, there's a dimension for the rows and a dimension for the columns
Thanks 🙏 @il_muflone
Обсуждают сегодня