小编Jor*_*evo的帖子

Tensorflow导入mnist警告

我正在使用Tensorflow做一个简单的教程,我刚刚安装了它应该更新,首先我使用以下代码加载mnist数据:

import numpy as np
import os
from tensorflow.examples.tutorials.mnist import input_data
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
train_data = mnist.train.images  # Returns np.array
train_labels = np.asarray(mnist.train.labels, dtype=np.int32)
eval_data = mnist.test.images  # Returns np.array
eval_labels = np.asarray(mnist.test.labels, dtype=np.int32)
Run Code Online (Sandbox Code Playgroud)

但是当我运行它时,我收到以下警告:

WARNING:tensorflow:From C:\Users\user\PycharmProjects\TensorFlowRNN\venv\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
WARNING:tensorflow:From C:/Users/user/PycharmProjects/TensorFlowRNN/sample.py:5: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions …
Run Code Online (Sandbox Code Playgroud)

python python-3.x tensorflow

18
推荐指数
2
解决办法
2万
查看次数

替换字符之间的点

因此,当在点之前没有空格时,我想要在字符串中使用子点.我认为这可以通过正则表达式轻松完成,但我无法做到.

我有模式,我希望它们是:

  • h.e.ll.o w.o.r.l.d: hello world
  • h.e.ll.o w.o.r.l.d: hello world
  • hello. world: hello. world

我尝试了以下模式:

\w+(\.)+\w+
\w+(\.+\w+)
\w+\.+\w+
Run Code Online (Sandbox Code Playgroud)

我总是得到这样的东西: he.ll.o wo.rl.d

我使用python的re模块来匹配和替换以下代码:

>>> re.sub(r'\w+\.+\w+', lambda x: x.group(0).replace('.', ''), 'h.e.ll.o w.o.r.l.d')
'he.llo wo.rl.d'
Run Code Online (Sandbox Code Playgroud)

python regex

3
推荐指数
1
解决办法
71
查看次数

根据SQL为表格中的每个事件计数

我在类似于PostgreSQL的类似SQL的数据库模式SQL中有表,类似于PostgreSQL,其中包含以下行:

server_time, user_id, transaction_id, revenue_eur
Run Code Online (Sandbox Code Playgroud)

我正在尝试查看重新转换,因此我想为每个用户计算他的第一,第二,第三...购买了什么。雪花允许横向连接,但我不确定该怎么做。

输出应如下所示:

      date     user_id   purchased_number
   2019-07-25  123121         1
   2019-07-26  123121         2
   2019-07-27  123121         3
   2019-07-25   8565          1  
   2019-07-25   8565          2
Run Code Online (Sandbox Code Playgroud)

sql snowflake-cloud-data-platform

0
推荐指数
1
解决办法
20
查看次数