小编Fra*_*urt的帖子

在 MySQL Workbench 的数据建模工具中对齐 EER 图中的两个表?

MySQL Workbench的数据建模工具中有没有自动对齐EER图中的表以使关系箭头笔直的方法?

例如,之前:

在此输入图像描述

后:

在此输入图像描述

我觉得每次都手动做很痛苦。

我不想使用自动布局功能,因为它经常弄乱,例如之前:

在此输入图像描述

后:

在此输入图像描述

mysql-workbench

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

更新了Anaconda,导入scipy时出现错误消息"无法导入名称'moduleTNC'"

我用Windows更新了anaconda conda update anaconda.现在我的ipython笔记本开始了

import numpy as np
from numpy.random import randn
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
...
Run Code Online (Sandbox Code Playgroud)

给我错误:

ImportError                               Traceback (most recent call last)
<ipython-input-1-2bb1109a8767> in <module>()
      2 from numpy.random import randn
      3 import pandas as pd
----> 4 from scipy import stats
      5 import matplotlib as mpl
      6 import matplotlib.pyplot as plt

C:\Users\Me\Anaconda\lib\site-packages\scipy\stats\__init__.py in <module>()
    336 from __future__ import division, print_function, absolute_import …
Run Code Online (Sandbox Code Playgroud)

python ipython-notebook anaconda

4
推荐指数
2
解决办法
6123
查看次数

使用Oracle SQL Developer查看表注释

如何在Oracle SQL Developer中查看表注释?


我添加了一些评论:

COMMENT ON TABLE my_table_name IS 'Here are my table comments';
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用一些SQL查询SELECT * FROM user_tab_comments;来显示注释,但是我很好奇可以使用Oracle SQL Developer的GUI查看它们,因为我们可以通过打开给定表的“列”选项卡来处理列注释。

在此处输入图片说明

oracle-sqldeveloper

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

如何检查SciPy CSR矩阵是否为空(即仅包含零)?

检查SciPy CSR矩阵是否为空(即仅包含零)的规范方法是什么?

我用nonzero():

def is_csr_matrix_only_zeroes(my_csr_matrix):
    return(len(my_csr_matrix.nonzero()[0]) == 0)

from scipy.sparse import csr_matrix
print(is_csr_matrix_only_zeroes(csr_matrix([[1,2,0],[0,0,3],[4,0,5]])))
print(is_csr_matrix_only_zeroes(csr_matrix([[0,0,0],[0,0,0],[0,0,0]])))
print(is_csr_matrix_only_zeroes(csr_matrix((2,3))))
print(is_csr_matrix_only_zeroes(csr_matrix([[0,0,0],[0,1,0],[0,0,0]])))
Run Code Online (Sandbox Code Playgroud)

输出

False
True
True
False
Run Code Online (Sandbox Code Playgroud)

但我想知道是否存在更直接或有效的方式.

(相关但不同:检查是否存在scipy稀疏矩阵条目)

python scipy sparse-matrix is-empty

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

如何在Theano的TensorVariable上执行范围?

如何在Theano的TensorVariable上执行范围?

例:

import theano.tensor as T
from theano import function

constant = T.dscalar('constant')
n_iters = T.dscalar('n_iters')
start = T.dscalar('start')
result = start  

for iter in range(n_iters):
    result = start + constant

f = function([start, constant, n_iters], result)
print('f(0,2,5): {0}'.format(f(1,2)))
Run Code Online (Sandbox Code Playgroud)

返回错误:

Traceback (most recent call last):
  File "test_theano.py", line 9, in <module>
    for iter in range(n_iters):
TypeError: range() integer end argument expected, got TensorVariable.
Run Code Online (Sandbox Code Playgroud)

在Theano的TensorVariable上使用范围的正确方法是什么?

python theano

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

键盘快捷键在GitHub桌面中同步

是否有任何键盘快捷方式在GitHub桌面同步?ENTER在编写提交注释后命中会创建提交,但我想知道如何在不使用鼠标的情况下进行同步.

keyboard-shortcuts github-desktop

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

剥离字符串并获取起始索引和结束索引

Python中是否有任何直接的方法来剥离字符串并获取起始索引和结束索引?

示例:给定字符串' hello world! ',我想要剥离的字符串'hello world!'以及起始索引2和和索引14.

' hello world! '.strip() 只返回剥离的字符串.

我可以写一个函数:

def strip(str):
    '''
    Take a string as input.
    Return the stripped string as well as the start index and end index.
    Example: '  hello world!   '  --> ('hello world!', 2, 14)
    The function isn't computationally efficient as it does more than one pass on the string.
    '''
    str_stripped = str.strip()
    index_start = str.find(str_stripped)
    index_end = index_start + len(str_stripped)
    return str_stripped, …
Run Code Online (Sandbox Code Playgroud)

python strip

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

为什么`tf.constant()`的值在TensorFlow中多次存储在内存中?

读过(在TensorFlow中):

a的值tf.constant()在内存中多次存储.

为什么tf.constant()在内存中多次存储的值?

python tensorflow

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

如何用pandas中的groupby计算绝对和?

如何用pandas中的groupby计算绝对和?

例如,给定DataFrame:

    Player  Score
0      A    100
1      B   -150
2      A   -110
3      B    180
4      B    125
Run Code Online (Sandbox Code Playgroud)

我希望玩家A的总得分(100 + 110 = 210)以及玩家A的总得分(150 + 180 + 125 = 455),忽略得分的符号.

我可以使用以下代码来计算总和:

import pandas as pd
import numpy as np

frame = pd.DataFrame({'Player' : ['A', 'B', 'A', 'B', 'B'], 
                      'Score'  : [100, -150, -110, 180, 125]})

print('frame: {0}'.format(frame))

total_scores = frame[['Player','Score']].groupby(['Player']).agg(['sum'])

print('total_scores: {0}'.format(total_scores))
Run Code Online (Sandbox Code Playgroud)

但是我如何用groupby计算绝对和?

frame[['Player','Score']].abs().groupby(['Player']).agg(['sum']) 不出所料的回报:

Traceback (most recent call last):
  File "O:\tests\absolute_count.py", line 10, in <module>
    total_scores = frame[['Player','Score']].abs().groupby(['Player']).agg(['sum'])
  File …
Run Code Online (Sandbox Code Playgroud)

python dataframe pandas pandas-groupby

4
推荐指数
2
解决办法
5321
查看次数

如何从 Python 中的 2D 散点图数据创建热图?

如何从 Python 中的 2D 散点图数据创建热图,其中散点图中的每个 (x,y) 点都有与其关联的 az 值?z 值将是用于为热图着色的值。


例如,在 R 中,我可以使用:

# This example is from http://knowledge-forlife.com/r-creating-heatmap-scatterplot-data/
#I'm just setting the seed so you can see the same example on your computer
set.seed(1)

#Our X data
x <- runif(150)

#Our Y data
y <- runif(150)

#Our Z data
z <- c(rnorm(mean=1,100),rnorm(mean=20,50))

#Store the length of our data
N <- length(x)

# View the scatterplot
plot(x, y)

#Here is the interpolation to give the heatmap effect. 
#Use xo and …
Run Code Online (Sandbox Code Playgroud)

python heatmap

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