I've seen some suggestions for pandas, which would also work well, but for something simple like this you may just want to use numpy:

import numpy as np

rainfall = np.loadtxt(filename, delimiter=',')
total = rainfall.sum()

print(f"The total rainfall for the year was {total:.0f}")
print(f"Overall Min: {rainfall.min()}")
print(f"Overall Max: {rainfall.max()}")
print("Weekly Sums:")
print(rainfall.sum(axis=1))
print("Weekly Mins:")
print(rainfall.min(axis=1))

Output:

The total rainfall for the year was 5344
Overall Min: 0.0
Overall Max: 30.0
Weekly Sums:
[ 89. 131.  91.  97.  68. 137. 113.  93. 115. 117. 128. 165.  89. 137.
  58. 100.  96. 106.  80.  91.  60. 102. 126.  80. 111. 113. 135.  77.
 100.  99. 129. 129. 118.  98.  93.  83.  99. 113.  85.  75. 100. 118.
  76. 110.  91.  82. 137. 128. 107. 117.  68.  84.]
Weekly Mins:
[ 0.  3.  4.  0.  0.  8.  2.  0.  3.  5.  0. 20.  1.  6.  1.  7.  3.  0.
  1.  1.  2.  2.  6.  2.  4.  3.  9.  4.  6.  2.  5. 11.  6.  5.  1.  1.
  0.  3.  0.  5.  1.  2.  1.  0.  2.  1. 11.  3.  5.  3.  0.  0.]
Answer from BeRT2me on Stack Overflow
๐ŸŒ
Quora
quora.com โ€บ How-can-I-find-the-maximum-value-in-the-first-column-in-an-array-in-Python
How to find the maximum value in the first column in an array in Python - Quora
What if you wanted only numbers ... lists, which can be indexed like 1 dimensional arrays. If you have such a thing, then min( ) and max() will work....
๐ŸŒ
ProjectPro
projectpro.io โ€บ recipes โ€บ compute-min-by-max-for-each-row-for-numpy-array-2d
How to compute the min-by-max for each row for a numpy array 2d? -
June 20, 2022 - MACHINE LEARNING RECIPES DATA CLEANING ... and maximum values from the each row of a 2D numpy array by using the "min" and "max" functions available in the Numpy library....
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 62640288 โ€บ how-to-find-max-min-and-average-by-using-if-technique-in-a-2d-array-in-python
how to find max, min and average by using if technique in a 2d array in python - Stack Overflow
You can 1) Flatten the list of lists and then take max, min, avg OR 2) use the fact that it is a 2d list and use a double loop ... Putnam I've tried the following program so far:x=[[80,59,34,89],[31,11,47,64],[29,56,13,91],[55,61,48,0],[75,...
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.2 โ€บ reference โ€บ generated โ€บ numpy.matrix.max.html
numpy.matrix.max โ€” NumPy v2.2 Manual
Return the maximum value along an axis ยท This is the same as ndarray.max, but returns a matrix object where ndarray.max would return an ndarray
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ find-the-maximum-value-in-each-row-and-column-of-a-numpy-2d-array
Find the maximum value in each row and column of a NumPy 2D array
In this shot we will discuss on how to find the maximum value across each row and each column in a NumPy 2D array. To solve the problem mentioned above, we will use amax() method from the numpy python package.
Find elsewhere
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 55124 โ€บ how-to-find-max-or-min-number-in-two-dimensional-array-
how to find max or min number in two dimensional array ?. | Sololearn: Learn to code for FREE!
http://code.sololearn.com/c1seF47iVi0S public class Program { public static int min(int[][] arr) { if ((arr.length == 0)||(arr[0].length == 0)) { throw new IllegalArgumentException("Empty array"); } int min = arr[0][0]; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { if (arr[i][j] < min) { min = arr[i][j]; } } } return min; } public static int max(int[][] arr) { if ((arr.length == 0)||(arr[0].length == 0)) { throw new IllegalArgumentException("Empty array"); } int max = arr[0][0]; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) {
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ find-the-maximum-and-minimum-element-in-a-numpy-array
Find the maximum and minimum element in a NumPy array
August 23, 2023 - import numpy as np # Create a 2D array data_2d = np.array([[1, 3, 5], [2, 4, 6], [7, 8, 9]]) # Calculate the maximum value along axis 0 (columns) max_axis_0 = np.max(data_2d, axis=0) # Calculate the maximum value along axis 1 (rows) max_axis_1 = np.max(data_2d, axis=1) print("Maximum value along axis 0:", max_axis_0) print("Maximum value along axis 1:", max_axis_1)
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ numpy โ€บ python-numpy-stat-exercise-1.php
NumPy: Find the maximum and minimum value of a given flattened array - w3resource
Original flattened array: [[0 1] [2 3]] Maximum value of the above flattened array: 3 Minimum value of the above flattened array: 0 ... a = np.arange(4).reshape((2,2)): This line creates a 2D array of shape (2, 2) using the np.arange function and then reshape it to the desired shape using the reshape method.
๐ŸŒ
Python Data Science Handbook
jakevdp.github.io โ€บ PythonDataScienceHandbook โ€บ 02.04-computation-on-arrays-aggregates.html
Aggregations: Min, Max, and Everything In Between | Python Data Science Handbook
In particular, their optional arguments have different meanings, and np.sum is aware of multiple array dimensions, as we will see in the following section. Similarly, Python has built-in min and max functions, used to find the minimum value and maximum value of any given array:
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-max-min-value-in-nth-column-in-matrix
Python | Max/Min value in Nth Column in Matrix - GeeksforGeeks
April 12, 2023 - In this, we pass in the zip() the list, to access all columns and max()/min() to get the maximum or minimum of columns. Firstly, a 2D list named test_list is initialized which contains three lists each containing three integers.
๐ŸŒ
Real Python
realpython.com โ€บ numpy-max-maximum
NumPy's max() and maximum(): Find Extreme Values in Arrays โ€“ Real Python
January 18, 2025 - In this introduction to NumPy, you'll learn how to find extreme values using the max() and maximum() functions. This includes finding the maximum element in an array or along a given axis of an array, as well as comparing two arrays to find ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ dsa โ€บ program-to-find-the-maximum-element-in-a-matrix
Program to find the maximum element in a Matrix - GeeksforGeeks
December 6, 2022 - # Python 3 code to find max element # in a matrix import sys N = 4 M = 4 # Function to find max element # mat[][] : 2D array to find max element def findMax(mat): # Initializing max element as INT_MIN maxElement = -sys.maxsize - 1 # checking ...