Introduction to TensorFlow in Python
Isaiah Hull
Visiting Associate Professor of Finance, BI Norwegian Business School
tensorflow
pandas
numpy
arraytensorflow
without modification# Import numpy and pandas
import numpy as np
import pandas as pd
# Load data from csv
housing = pd.read_csv('kc_housing.csv')
# Convert to numpy array
housing = np.array(housing)
read_json()
, read_html()
, read_excel()
Parameter | Description | Default |
---|---|---|
filepath_or_buffer |
Accepts a file path or a URL. | None |
sep |
Delimiter between columns. | , |
delim_whitespace |
Boolean for whether to delimit whitespace. | False |
encoding |
Specifies encoding to be used if any. | None |
# Load KC dataset
housing = pd.read_csv('kc_housing.csv')
# Convert price column to float32
price = np.array(housing['price'], np.float32)
# Convert waterfront column to Boolean
waterfront = np.array(housing['waterfront'], np.bool)
# Load KC dataset
housing = pd.read_csv('kc_housing.csv')
# Convert price column to float32
price = tf.cast(housing['price'], tf.float32)
# Convert waterfront column to Boolean
waterfront = tf.cast(housing['waterfront'], tf.bool)
Introduction to TensorFlow in Python