title: Python pandas: set row and col to zeros if element is zero
body: <p>I'm trying to solve the following python interview questions using Pandas:</p>
  
  <p>Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.</p>
  
  <p>Here are some examples:</p>
  
  <pre><code># Example 1
  [[1, 1, 1], [1, 0, 1], [1, 1, 1]]  # input
  [[1, 0, 1], [0, 0, 0], [1, 0, 1]]  # output
  
  # Example 2
  [[0, 1, 2, 0], [3, 4, 5, 2], [1, 3, 1, 5]]  # input
  [[0, 0, 0, 0], [0, 4, 5, 0], [0, 3, 1, 0]]  # output
  </code></pre>
  
  <p>Here's the solution I came up with:</p>
  
  <pre><code>def solution(mat):
      """Brute force - O(n**2)"""
      cols = []
      for i, row in enumerate(mat):
          for j, item in enumerate(row):
              if item == 0:
                  mat[i] = [0] * len(row)
                  cols.append(j)
  
      for i, _ in enumerate(mat):
          for j in cols:
              mat[i][j] = 0
  </code></pre>
  
  <p>Is there a better way to do this using Pandas?</p>