小编Pro*_*ken的帖子

PostgreSQL:将序列的最大值设置为更高的值

目前,我正在将数据从 RabbitMQ Worker 导入到 postgreSQL 中的表中。这样做时我收到此错误:

4|tiq-work | error: nextval: reached maximum value of sequence "table_id_seq" (2147483647)

table.id数据类型为 int8 (bigint),范围为9223372036854775807

我尝试使用 postgreSQL 文档中的以下命令设置最大值:

alter sequence schema.table_id_seq maxvalue 9223372036854775807;

但随后收到此错误:

SQL Error [22023]: ERROR: MAXVALUE (9223372036854775807) is out of range for sequence data type

这似乎是因为序列数据类型的范围与整数数据类型 (2147483647) 相同。

有没有办法迫使它走得更高?我还有很多数据要加载。

postgresql

9
推荐指数
1
解决办法
1万
查看次数

TensorFlow InternalError:无法将元素作为字节获取

我试图在一些包含分类和数字数据的日志数据上运行带有TensorFlow的DNNClassifier.我创建了功能列来指定和散列/散列数据以进行张量流.当我运行代码时,我收到'无法获取元素为字节'内部错误.注:我不想因为这说明砸楠价值的文章,所以我用这个代码它们转换为0 train = train.fillna(0, axis=0),所以我不知道为什么我还在流汗此错误.如果我dropna然后它工作但我不想放弃Nan的,因为我觉得他们需要模型训练.

def create_train_input_fn(): 
    return tf.estimator.inputs.pandas_input_fn(
        x=train,
        y=train_label, 
        batch_size=32,
        num_epochs=None,
        shuffle=True)

def create_test_input_fn():
    return tf.estimator.inputs.pandas_input_fn(
        x=valid,
        y=valid_label, 
        num_epochs=1,
        shuffle=False)
feature_columns = []
end_time = tf.feature_column.embedding_column(tf.feature_column.categorical_column_with_hash_bucket('end_time', 1000), 10)
feature_columns.append(end_time)
device = tf.feature_column.embedding_column(tf.feature_column.categorical_column_with_hash_bucket('device', 1000), 10)
feature_columns.append(device)
device_os = tf.feature_column.embedding_column(tf.feature_column.categorical_column_with_hash_bucket('device_os', 1000), 10)
feature_columns.append(device_os)
device_os_version = tf.feature_column.embedding_column(tf.feature_column.categorical_column_with_hash_bucket('device_os_version', 1000), 10)
feature_columns.append(device_os_version)
Latency = tf.feature_column.bucketized_column(
    tf.feature_column.numeric_column('Latency'), 
    boundaries=[.000000, .000010, .000100, .001000, .010000, .100000])
feature_columns.append(Latency)
Megacycles = tf.feature_column.bucketized_column(
    tf.feature_column.numeric_column('Megacycles'), 
    boundaries=[0, 50, 100, 200, 300])
feature_columns.append(Megacycles)
Cost = tf.feature_column.bucketized_column(
    tf.feature_column.numeric_column('Cost'), 
    boundaries=[0.000001e-08, 1.000000e-08, 5.000000e-08, …
Run Code Online (Sandbox Code Playgroud)

python tensorflow jupyter-notebook

8
推荐指数
1
解决办法
4008
查看次数

在Pandas Dataframe中查找重复的行,然后在Dataframe中添加一个列,表明该行是否重复

我有一个pandas数据框,其中包含一个可能重复的列.我想创建一个列,如果行重复则生成1,如果不重则则生成0.

所以,如果我有:

     A|B
1    1|x
2    2|y
3    1|x
4    3|z
Run Code Online (Sandbox Code Playgroud)

我会得到:

     A|B|C
1    1|x|1
2    2|y|0
3    1|x|1
4    3|z|0
Run Code Online (Sandbox Code Playgroud)

我试过df['C'] = np.where(df['A']==df['A'], '1', '0')但这只是在C中创建了一个全1的列.

python duplicates dataframe pandas

4
推荐指数
1
解决办法
2763
查看次数