小编Dyn*_* Fu的帖子

如何在perforce中列出我搁置的变化?

p4 shelve节省了我很多努力,用不同的变化编辑同一个文件.

问题是在我搁置了一些变化之后,我开始忘记我搁置的东西了.有没有办法列出我搁置的所有变化?我检查p4 help unshelve/shelve但找不到选项.

perforce

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

createOrReplaceTempView和registerTempTable之间的区别

我是新来的火花,sparkSql当我遇到这两个命令时,我正在尝试使用python中的一些命令:

createOrReplaceTempView()和registerTempTable().

这两个命令有什么区别?它们似乎具有相同的功能集.

apache-spark apache-spark-sql pyspark sparkr pyspark-sql

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

你如何在matplotlib中使用普通话字符?

我一直在尝试使用matplotlib的文本或用普通话中文注释模块.不知何故,它最终显示框.有什么想法吗?

unicode matplotlib utf-8

14
推荐指数
1
解决办法
7155
查看次数

大于Makefile中的字符串比较

如何在Makefile中表达以下逻辑?

if $(XORG_VERSION) > "7.7"
   <do some thing>
fi
Run Code Online (Sandbox Code Playgroud)

Makefile的条件部分仅提供ifeq或ifneq.

makefile

11
推荐指数
2
解决办法
5116
查看次数

如何用空体定义rpm spec宏?

问题很容易展现:

rpm --eval "%define xyz"
error: Macro %xyz has empty body
Run Code Online (Sandbox Code Playgroud)

我想得到patch_level并且echo_dist可以返回sles11或sles11sp1,对于sle1s11我只想让patch_level成为一个空字符串,但这会导致空体错误.

rpm --eval "%{expand: %%define patch_level %(echo_dist | sed -e "s/sles11//")}
Run Code Online (Sandbox Code Playgroud)

我不完全理解rpm规范文件,对问题的任何建议?

specifications rpm

10
推荐指数
1
解决办法
7173
查看次数

哪种款式首选?

选项1:

def f1(c):
  d = {
    "USA": "N.Y.",
    "China": "Shanghai"
  }

  if c in d:
    return d[c]

  return "N/A"
Run Code Online (Sandbox Code Playgroud)

选项2:

def f2(c):
  d = {
    "USA": "N.Y.",
    "China": "Shanghai"
  }

  try:
    return d[c]
  except:
    return "N/A"
Run Code Online (Sandbox Code Playgroud)

这样我就可以打电话:

for c in ("China", "Japan"):
  for f in (f1, f2):
    print "%s => %s" % (c, f(c))
Run Code Online (Sandbox Code Playgroud)

选项是确定密钥是否在预先存在于目录中(f1),或者只是回退到异常(f2).哪一个更受欢迎?为什么?

python coding-style exception

9
推荐指数
4
解决办法
367
查看次数

强制matplotlibrc使用Arial(字体路径)

我的系统中安装了Arial字体:

/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf
/usr/share/fonts/truetype/msttcorefonts/arialbi.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
/usr/share/fonts/truetype/msttcorefonts/arial.ttf
/usr/share/fonts/truetype/msttcorefonts/ariali.ttf
/usr/share/fonts/truetype/msttcorefonts/arialbd.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Black.ttf
/usr/share/xbmc/media/Fonts/arial.ttf
/usr/local/share/texmf/fonts/tfm/urw/arial
/usr/local/share/texmf/fonts/afm/urw/arial
/usr/local/share/texmf/fonts/vf/urw/arial
/usr/local/share/texmf/fonts/type1/urw/arial
Run Code Online (Sandbox Code Playgroud)

我在matplotlibrc里面改了一行,包括:

font.sans-serif      : Arial
Run Code Online (Sandbox Code Playgroud)

如果我在IPython中检查:

import matplotlib.pyplot as plt
plt.plot([1,2,3,4,5,], '*')
t = plt.ylabel(r'1, 2, 3, 8, 9 6 11 Testing Label')
print(t.get_fontname())
Run Code Online (Sandbox Code Playgroud)

输出是:

myhome/local/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-
x86_64.egg/matplotlib/font_manager.py:1279: UserWarning: findfont: Font
family [u'sans-serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))

Bitstream Vera Sans
Run Code Online (Sandbox Code Playgroud)

如何更改此行为并为我的所有绘图使用Arial字体?为什么没有加载Arial字体?

有趣的是,如果我使用Seaborn,它会返回Liberation Sans第一个字体(内部字体列表内部)为Arial,第二个字体为Arial Liberation Sans.

matplotlib python-2.7 seaborn

7
推荐指数
1
解决办法
4556
查看次数

arff加载到Python时数据中出现字母

我已经使用以下代码将 arff 文件加载到 python 中:

import pandas as pd, scipy as sp
from scipy.io import arff
datos,meta = arff.loadarff(open('selectividad.arff', 'r'))
d = pd.DataFrame(datos)
Run Code Online (Sandbox Code Playgroud)

当我使用 head 函数查看数据框时,它是这样的: 在此输入图像描述

但是,这些“b”不存在于 arff 文件中,如下所示: https: //gyazo.com/3123aa4c7007cb4d6f99241b1fc41bcb 这里有什么问题?非常感谢

python weka arff pandas

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

编写一个可以在熊猫数据框中从十六进制转换为ASCII格式的函数

我正在尝试编写可以将数据帧(df)和column(col)作为输入并将column中的编码HEX转换为ascii的函数。

我已经尝试过,"7061756c".decode("hex")但是我不确定我可以在col列中申请全部记录,以下是我尝试过的代码

def hex_to_ascii(df , col):
    for i in range(0,len(df['col'].values)):
        string = bytearray.fromhex(df['col'].values[i]).decode()
Run Code Online (Sandbox Code Playgroud)

我被困在这里,有人可以帮忙吗

python pandas

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