就像给猫喂泡菜(1)

sourpuss的Python项目详细描述


sourpuss:就像给猫喂泡菜一样(1)

sourpuss按标准显示一个或多个python pickle文件的内容 输出。目前,这个小型实用程序的目标是pickled pandas数据帧 并支持以简单的方式转换它们。其他腌制对象 (例如dict、numpy数组等)被强制为数据帧。通过制作 通过unix管道很容易回答简单的问题,sourpuss允许您 避免经常在$shell和jupyter/ipython之间切换上下文。

帮助:

Usage: sourpuss [OPTIONS] [FILE]...

  Cat Python pickle file(s) onto standard output, especially DataFrames.

Options:
  -a, --append-index TEXT  Append named column to the index.
  -c, --csv                Emit CSV instead of formatted table.
  -l, --location           Prefix each row with the location of the file
  -m, --multi-sparse       Sparsify any MultiIndex display.
  -n, --no-index           Do not display the index.
  -p, --precision DIGITS   Change precision for floating point.  [default: 17]
  -q, --query QUERY        Show only rows satisfying a query.
  -r, --reset-index TEXT   Remove named column from the index.
  -s, --sort-index         Sort according to the index.
  -t, --types              Show the type, not the value, of each datum.
  --help                   Show this message and exit.

示例:

$ sourpuss data_frame.pkl
            name              city  phone-number        date
Katherine Rivera              Pavo  540-489-5084  1973-01-18
   Katie Estrada            Antler  992-454-3547  2003-07-07
    Scott Harris        Colesville  665-552-3378  1989-01-01
  Anthony Flores         Round Oak  437-057-2113  1975-01-27
   Deborah Clark  Balcones Heights  871-803-9642  1978-02-07
    Andrea Owens            Lucile  308-267-6029  2018-01-05
  Kimberly Myers       Holly Ridge  906-150-0581  2002-02-26
Katherine Garner       Dalton City  687-950-3807  1984-06-16
 Brianna Preston           Bernice  489-937-8732  1970-11-28
   Justin Herman  Milleville Beach  847-845-5160  1984-11-10


$ sourpuss data_frame.pkl -q 'city == "Pavo"'
            name  city  phone-number        date
Katherine Rivera  Pavo  540-489-5084  1973-01-18


$ sourpuss data_frame.pkl -a city -a name -s | head -5
                                   phone-number        date
city             name
Antler           Katie Estrada     992-454-3547  2003-07-07
Balcones Heights Deborah Clark     871-803-9642  1978-02-07
Bernice          Brianna Preston   489-937-8732  1970-11-28

$ sourpuss numpy_array.pkl -a 1 -s -p 6
                  0         2         3         4
1
-0.686618 -0.309380 -0.787130  0.794882 -2.045493
-0.579552  0.338158 -0.269337  1.290424 -0.872747
-0.014240  0.333677  0.235846 -0.614426  0.222267
 0.317477  0.407887 -0.289088 -0.231201  0.046131
 1.307109 -0.383681  0.009120 -0.978323  0.446737

新闻

0.3

发布日期:2018年10月1日

  • 空数据帧上的输出更均匀
  • 将列强制为字符串以允许追加/重置数值
  • 删除了挥之不去的待办事项

0.2

发布日期:2018年9月29日

  • 支持更广泛的类型集合,包括测试。
  • 默认情况下,在输出中抑制不感兴趣的范围索引。

0.1

发布日期:2018年9月28日

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何通过解决错误“活动无法转换为片段”将片段传递给类构造函数?   Java中清理Code39条码数据的regex帮助   将java转换为C++   java无法在Android Studio中生成签名的apk,出现错误   从数学方程出发   MySQL和Java内存问题   如何强制Java抛出算术异常?   java为什么JDBC将零端口视为空(默认)端口?   java如何在没有“changelog主题”的情况下加入KStream和KTable   排序我尝试合并两个排序的数组,但得到的是java。lang.ArrayIndexOutofBounds异常:5无法找出原因   如何在java中求大长度矩阵的逆?   基于maven构建的java生成类路径字符串   java每20个字符分割一个字符串,然后将每个部分打印到控制台   将字符串数字字转换为字符串数字:Java   在特定区域使用混合类型的java填充字节数组   尽管java类在开关块中实例化,但它只能调用接口方法