我是角度新手。我正在将一些字段动态渲染为我的反应形式。当我使用模拟请求时,一切都很好ng serve(即渲染正确发生,console.log 中没有错误)。一旦我ng build使用正确的后端构建项目,我就会收到动态渲染的每个字段的错误:
main.js:1 ERROR TypeError: Cannot read property '_rawValidators' of null
Run Code Online (Sandbox Code Playgroud)
我找不到此错误的任何背景。我很想听听你的想法。
// these fields change with selection
this.datafields = [{
dfId: 48,
dfName: "Phone",
dfType: "text",
dfOptions: null,
dfValue: ""
},
{
dfId: 49,
dfName: "Eval",
dfType: "select",
dfOptions: ["","Remote","Live"],
df_value: "",
}]
Run Code Online (Sandbox Code Playgroud)
打字稿渲染ngOnInit(尝试过ngAfterViewInit但没有改进)
dfGroup = new FormGroup({})
...
...
this.eyeForm = this.formBuilder.group({
focus: ['', Validators.required],
datafields: this.formBuilder.array([])
})
...
...
if (this.datafields != null || this.datafields != …Run Code Online (Sandbox Code Playgroud) 我有这段代码,它在 python 3 中引发了一个错误,这样的比较可以在 python 2 上工作,我该如何更改它?
import tensorflow as tf
def train_set():
class MyCallBacks(tf.keras.callbacks.Callback):
def on_epoch_end(self,epoch,logs={}):
if(logs.get('acc')>0.95):
print('the training will stop !')
self.model.stop_training=True
callbacks=MyCallBacks()
mnist_dataset=tf.keras.datasets.mnist
(x_train,y_train),(x_test,y_test)=mnist_dataset.load_data()
x_train=x_train/255.0
x_test=x_test/255.0
classifier=tf.keras.Sequential([
tf.keras.layers.Flatten(input_shape=(28,28)),
tf.keras.layers.Dense(512,activation=tf.nn.relu),
tf.keras.layers.Dense(10,activation=tf.nn.softmax)
])
classifier.compile(
optimizer='sgd',
loss='sparse_categorical_crossentropy',
metrics=['accuracy']
)
history=classifier.fit(x_train,y_train,epochs=20,callbacks=[callbacks])
return history.epoch,history.history['acc'][-1]
train_set()
Run Code Online (Sandbox Code Playgroud) 我需要将动态高度值设置为 DataTable Widget 的 dataRowHeight 属性以适应不同的 Row 内容,但我不想使用允许这样做的 Table Widget。-#flutter
默认情况下,它使用 DataTableThemeData 中定义的 kMinInteractiveDimension 值 (48.0)。
DataTable(dataRowHeight: 150, columns: [DataColumn()...], rows: [DataRow()....])
Run Code Online (Sandbox Code Playgroud)
检查这个图像:

dart flutter flutter-layout material-components-android flutter-table
之前只询问过这个问题的一部分([1] [2]),它解释了如何分割numpy数组.我是Python的新手.我有一个包含262144个项目的数组,并希望将它分成长度为512的小数组,单独对它们进行排序并总结它们的前五个值,但我不确定如何超出这一行:
np.array_split(vector, 512)
Run Code Online (Sandbox Code Playgroud)
如何调用和分析每个数组?继续使用numpy数组或者我应该还原并使用字典而不是它是个好主意吗?
考虑 assets/logdata.txt 中的标准 Web 日志文件。该文件记录了用户在访问网页时进行的访问(就像这个!)。日志的每一行都有以下项目:
'146.204.224.152')'feest6811'用户名(例如,注意:有时缺少用户名!在这种情况下,使用“-”作为用户名的值。)'21/Jun/2019:15:45:24 -0700')'POST /incentivize HTTP/1.1'注意:并非所有内容都是 POST!)您的任务是将其转换为字典列表,其中每个字典如下所示:
example_dict = {"host":"146.204.224.152",
"user_name":"feest6811",
"time":"21/Jun/2019:15:45:24 -0700",
"request":"POST /incentivize HTTP/1.1"}
Run Code Online (Sandbox Code Playgroud)
这是 txt 数据文件的示例。

我写了这几行代码:
import re
def logs():
with open("assets/logdata.txt", "r") as file:
logdata = file.read()
#print(logdata)
pattern="""
(?P<host>.*)
(-\s)
(?P<user_name>\w*)
(\s)
([POST]*)
(?P<time>\w*)
"""
for item in re.finditer(pattern,logdata,re.VERBOSE):
print(item.groupdict())
return(item)
logs()
Run Code Online (Sandbox Code Playgroud)
它帮助我进行了制作"host","user_name"但是我无法继续完成其余的要求。有人可以帮忙吗?

我可以在 python 中制作直方图,但无法添加密度曲线,我看到许多代码使用不同的方式在直方图上添加密度曲线,但我不确定如何获取我的代码
我添加了密度 = true 但无法在直方图上获得密度曲线
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
X=df['A']
hist, bins = np.histogram(X, bins=10,density=True)
width = 0.7 * (bins[1] - bins[0])
center = (bins[:-1] + bins[1:]) / 2
plt.bar(center, hist, align='center', width=width)
plt.show()
Run Code Online (Sandbox Code Playgroud) 我从 Kraken 收到 ohlc 数据,EPOCH 时间以毫秒为单位。邮箱:1599651300
当我绘制数据时,我看到纪元号,但我想看到日期(es:2020 年 9 月 10 日 12:23)。
我该怎么做?
ohlc, last = k.get_ohlc_data("BCHEUR", 5)
# plot candlestick chart
candle = go.Candlestick(
x = ohlc['time'],
open = ohlc['open'],
close = ohlc['close'],
high = ohlc['high'],
low = ohlc['low'],
name = "Candlesticks")
data = [candle]
# style and display
layout = go.Layout()
fig = go.Figure(data = data, layout = layout)
plot(fig)
Run Code Online (Sandbox Code Playgroud)
嗨,我收到以下错误,有人可以告诉我可能有什么问题吗?
当我打电话时, os.fit_sample(X,y)
'RandomOverSampler' 对象没有属性 '_validate_data'
我有一个字典d,其中有几个列表存储在其中.如果我打印字典,我会很难读出输出:
{'Patch(0,8)': [28, 56, 75], 'Patch(0,6)': [1, 11, 17, 19, 20, 23, 28, 30, 44, 45, 49, 56, 60, 63, 75, 81, 91, 99],
'Patch(4,0)': [2, 5, 6, 8, 19, 22, 23, 27, 31, 34, 35, 36, 41, 45, 51, 52, 53, 55, 56, 59, 60, 61, 62, 64, 66, 67, 68, 70, 73, 75, 76, 77, 79, 85, 87, 91, 94, 96],
'Patch(4,6)': [19, 23, 45, 56, 60, 75, 91], 'Patch(0,0)': [0, 1, 2, 3, 4, 5, …Run Code Online (Sandbox Code Playgroud) python ×7
numpy ×2
pandas ×2
angular ×1
arrays ×1
dart ×1
dataframe ×1
dictionary ×1
flutter ×1
imblearn ×1
javascript ×1
keras ×1
material-components-android ×1
matplotlib ×1
ng-build ×1
plotly ×1
regex ×1
seaborn ×1
split ×1
tensorflow ×1
typeerror ×1
typescript ×1