小编cof*_*ant的帖子

如何在本地机器上显示matplotlib图?

我在远程服务器上远程运行ipython.我使用serveraddress:8888/etc访问它来为我的笔记本编写代码.

当我使用matplotlib时,这些图是内联的.有没有办法远程发送数据,以便打开绘图窗口?我想在我的本地机器上matplotlib上的整个交互式环境以及服务器机器上的所有数字运算?这是一个非常基本的东西....但不知何故,经过谷歌相当长一段时间后,我无法弄明白.

python matplotlib

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

如何在GitHub上使用多个SSH密钥?

GitHub上的SSH配置似乎是一场噩梦.我有多个GitHub帐户,但我可以拥有多个SSH密钥.在GitHub SSH配置部分,他们提到了这一点:

============
ssh-keygen -t rsa -C"your_email@example.com"

使用提供的电子邮件作为标签创建新的ssh密钥

生成公钥/私钥rsa密钥对.

我们强烈建议保留默认设置,因此当系统提示您"输入要保存密钥的文件"时,只需按Enter继续.

#输入保存密钥的文件(/Users/you/.ssh/id_rsa):[按enter键]

为什么我总是要使用id_rsa文件?它将覆盖我现有的密钥.无论如何,我在这里给出一个新名称并生成密钥.我执行将其添加到代理程序的所有其他步骤,在GitHub SSH密钥部分中进行更新.

完成所有这些步骤后,我进入最后一步,即:

ssh -vT git@github.com
Hi animesh11! You've successfully authenticated, but GitHub does not     provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3128, received 1976 bytes, in 0.5 seconds
Bytes per second: sent 6077.0, received 3838.9
debug1: Exit status 1
Run Code Online (Sandbox Code Playgroud)

一切都是笨拙的海鲂,但不知何故git clone仍然抱怨:

MacBook-Pro:Documents animeshsaxena$ git clone git@github.com:regentmarkets/devbox.git
Cloning into 'devbox'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

    Please …
Run Code Online (Sandbox Code Playgroud)

git ssh github

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

熊猫 - 极其缓慢

我想在日期对象上做一个df.apply,但它太慢了!

我的修剪输出给....

 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  1999   14.563    0.007   14.563    0.007 {pandas.tslib.array_to_timedelta64}
 13998    0.103    0.000   15.221    0.001 series.py:126(__init__)
  9999    0.093    0.000    0.093    0.000 {method 'reduce' of 'numpy.ufunc' objects}
272012    0.093    0.000    0.125    0.000 {isinstance}
  5997    0.089    0.000    0.196    0.000 common.py:199(_isnull_ndarraylike)
Run Code Online (Sandbox Code Playgroud)

所以基本上它是一个2000长度阵列的14秒.我的实际数组大小> 100,000,转换为运行时间> 15分钟或更长.

调用这个函数"pandas.tslib.array_to_timedelta64"这是一个瓶颈,这是熊猫的愚蠢行为吗?我真的不明白为什么这个函数调用是必要的??? 减法中的运算符都具有相同的数据类型.我明确地使用pd.to_datetime()方法转换它们.并且此计算中不包括此转换时间.

所以你可以理解我对这个可怜代码的沮丧!

实际代码看起来像这样

 df  = pd.DataFrame(bet_endtimes)

def testing():
    close_indices = df.apply(lambda x: np.argmin(np.abs(currentdata['date'] - x[0])),axis=1)
    print close_indices

 %prun testing()
Run Code Online (Sandbox Code Playgroud)

python performance pandas

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

标签 统计

python ×2

git ×1

github ×1

matplotlib ×1

pandas ×1

performance ×1

ssh ×1