请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

TypeError: 'CClass' object is not callabl

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import pandas as pd
import os
import sys
import time
import tensorflow as tf
from sklearn.preprocessing import StandardScaler
from tensorflow import keras

print(tf.version) #打印一下版本的问题
print(sys.version_info)
for module in mpl,np,pd,sklearn,tf,keras:
print(module.name,module.version)

from sklearn.datasets import fetch_california_housing
import pprint
from sklearn.model_selection import train_test_split
housing = fetch_california_housing()
print(housing.DESCR)
print(housing.data.shape)
print(housing.target.shape)

pprint.pprint(housing.data[0:5])
pprint.pprint(housing.target[0:5])

x_train_all ,x_test,y_train_all,y_test = train_test_split(
housing.data,
housing.target,
random_state=7
)
x_train,x_valid,y_train,y_valid = train_test_split(
x_train_all,
y_train_all,
random_state=11
)
print(x_train.shape,y_train.shape)
print(x_valid.shape,y_valid.shape)
print(x_test.shape,y_test.shape)
scaler = StandardScaler()
x_train_scaled = scaler.fit_transform(x_train)
x_valid_scaled = scaler.fit_transform(x_valid)
x_test_scaled = scaler.transform(x_test)
output_dir = 'generate_csv’
if not os.path.exists(output_dir):
os.mkdir(output_dir)

def save_to_csv(output_dir, data, name_prefix,
header=None,n_parts = 10):
pass

train_data = np.c_(x_train_scaled,y_train) #这个函数可以按行进行merge操作
valid_data = np.c_(x_valid_scaled,y_valid)
test_data = np.c_(x_train_scaled,y_test)
header_cols = []
print(housing.feature_name)

出现错误
Traceback (most recent call last):
File “C:/study tensorflow/study1/tf.data.csv.py”, line 57, in
train_data = np.c_(x_train_scaled,y_train) #这个函数可以按行进行merge操作
TypeError: ‘CClass’ object is not callable

正在回答 回答被采纳积分+3

1回答

正十七 2019-09-26 00:12:38

np.c_用中括号

https://stackoverflow.com/questions/34479794/python-np-c-errorcclass-object-is-not-callabel

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信