title: Why isn't the value printing in python?
body: <p>Here is a snippet of my python program to run linear regression with Tensorflow:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import tensorflow as tf
  import xlrd
  
  DATA_FILE = "fire_theft.xls"
  
  #Step 1: read in data from the .xls file
  book = xlrd.open_workbook(DATA_FILE, encoding_override="utf-8")
  #access the first sheet in the workbook
  sheet = book.sheet_by_index(0)
  #start from row index 1 to row index sheet.nrows-1
  data = np.asarray([sheet.row_values(i) for i in range(1, sheet.nrows)])
  n_samples = sheet.nrows-1
  
  #Step 2: create placeholders for input X (number of fire) and label Y (number
  #of theft)
  X = tf.placeholder(tf.float32, name="X")
  Y = tf.placeholder(tf.float32, name="Y")
  
  #Step 3: create weight and bias, initialized to 0
  w = tf.Variable(0.0, name="weights")
  b = tf.Variable(0.0, name="bias")
  
  #Step 4: construct model to predict Y (number of theft) from the number of fire
  Y_predicted = X * w + b
  
  #Step 5: use the square error as the loss function
  loss = tf.square(Y - Y_predicted, name="loss")
  
  #Step 6: use gradient descent with learning rate = 0.01 to minimize loss
  optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.01).minimize(loss)
  
  with tf.Session() as sess:
      #Step 7: initialize the necessary variables, in this case w and b
      sess.run(tf.global_variables_initializer())
  
      #Step 8: train the model
      for i in range(100): #run 100 epochs
          for x, y in data:
              #Session runs train_op to minimize loss
              sess.run(optimizer, feed_dict={X: x, Y: y})
  
      #Step 9: output the values of w and b
      w_value, b_value = sess.run([w, b])
      print('y = ' + str(sess.run(w)) + 'x' + ' + ' + str(sess.run(b)))
  </code></pre>
  
  <p>However, when sess.run([w, b]) is called near the end of the code, the matrix [w, b] is not printed. I am not sure why.</p>
  
  <p>Also, the print statement at the end returns "y = nanx + nan". I am not sure why w and b are both not interpreted as numbers. Can anybody help me?</p>
  
  <p>By the way, the fire_theft.xls file looks like:</p>
  
  <p>3.5 6</p>
  
  <p>5.3 7.4</p>
  
  <p>... (etc)</p>