Nhập môn TensorFlow bằng Python
Isaiah Hull
Visiting Associate Professor of Finance, BI Norwegian Business School

tensorflowpandasnumpytensorflow không cần sửa đổi# 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()| Tham số | Mô tả | Mặc định |
|---|---|---|
filepath_or_buffer |
Nhận đường dẫn tệp hoặc URL. | None |
sep |
Ký tự phân tách cột. | , |
delim_whitespace |
Boolean: có phân tách theo khoảng trắng hay không. | False |
encoding |
Mã hóa sử dụng (nếu có). | 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)
Nhập môn TensorFlow bằng Python