How to Sum List of Lists in Python? [Rows]

Problem: Given a list of lists representing a data matrix with n rows and m columns. How to sum over the rows of this matrix? In this article, you’re going to learn different ways to accomplish this in Python.

Let’s ensure that you’re on the same page. Here’s a graphical representation of the list of lists and what you want to achieve:

Example: Given the following code.

# Your list of lists
data = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]

# … Algorithm here …

# OUTPUT: [6, 15, 24]

Background: To learn more about list of lists, check out our reference article on

Continue reading the original article