小编avi*_*hse的帖子

更改熊猫数据框中完整行的颜色

我已经在 excel 文件上应用了熊猫,下面是数据框:

      Name  Count
0   Name 1     75
1   Name 2     55
2   Name 3     50
3   Name 4     47
4   Name 5     43
5   Name 6     42
6   Name 7     35
7   Name 8     34
8   Name 9     32
9   Name 10    16
10  Name 11     6
11  Name 12     3
12  Name 13     1
13  Name 14     1
14    Total   440
Run Code Online (Sandbox Code Playgroud)

我必须对上述数据框应用条件格式并转换为 html。

为此,我遵循了样式“ http://pandas.pydata.org/pandas-docs/stable/style.html#Building-Styles ”并执行了以下操作:

def change_colour(val):
   return ['background-color: red' if x < 40 else 'background-color: …
Run Code Online (Sandbox Code Playgroud)

python-3.x pandas

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

在C中创建docx文件时,"文件已损坏"

我正在使用"UNIX"(在我的虚拟机上)并使用"C"生成".docx"文件,在将文件导入Windows后,当我打开文件时它说"文件已损坏,不能是打开"然后它不开放.我正在使用MS-Word 2010.

这是我正在使用的一段代码: -

Write_to_file(){
 FILE *fp;
 if((fp=fopen("hello.docx","w"))==(FILE*)NULL){
  printf("Error opening file");
  return 0;
 }
 fprintf(fp,"Hello World");
 fclose(fp);
}
Run Code Online (Sandbox Code Playgroud)

c

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

sprintf的奇怪工作

#include<stdio.h>
#include<time.h>
int main(){
  char filepath[100];
  char datevar[15];
  char command[30];
  struct tm *t1;
  time_t now ;
  time(&now);
  memcpy(&t1,localtime(&now),sizeof(t1));
  t1 = localtime(&now);
  memset(filepath,0,sizeof(filepath));
  sprintf(datevar,"%04d%02d%02d",t1->tm_year+1900,t1->tm_mon+1,t1->tm_mday);
  strcpy(filepath,"abc");
  strcat(filepath,"/xyx/");
  strcat(filepath,datevar);
  strcat(filepath,"/");
  printf("filepath  1:- %s\n",filepath);
  sprintf(command, "hello %s good path",filepath);
  printf("filepath  2:- %s\n",filepath);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

在上面的程序中,两者printf都是不同的打印filepath.我得到的输出: -

filepath  1:- abc/xyx/20130430/
filepath  2:- h
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果我使用它,为什么会改变文件路径sprintf.

c printf

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

wxwidget编译失败了mingw

我用以下命令编译wxWidgets-3.1.0:

C:\wxWidgets-3.1.0\build\msw>mingw32-make -f makefile.gcc
if not exist ..\..\lib\gcc_lib\mswud mkdir ..\..\lib\gcc_lib\mswud
gcc -c -o gcc_mswud\wxtiff_tif_win32.o -g -O0 -mthreads  -DHAVE_W32API_H -DNDEBUG -I..\..\src\zlib -I..\..\src\jpeg -I..\..\src\tiff\libtiff   -MTgcc_mswud\wxtiff_tif_win32.o -MFgcc_mswud\wxtiff_tif_win32.o.d -MD -MP ../../src/tiff/libtiff/tif_win32.c
In file included from ../../src/tiff/libtiff/tiffio.h:257:0,
                from ../../src/tiff/libtiff/tiffiop.h:59,
                from ../../src/tiff/libtiff/tif_win32.c:30:
c:\mingw\include\stdio.h:345:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__mingw__snprintf'
extern int __mingw_stdio_redirect__(snprintf)(char*, size_t, const char*, ...);
            ^
makefile.gcc:6018: recipe for target 'gcc_mswud\wxtiff_tif_win32.o' failed
mingw32-make: *** [gcc_mswud\wxtiff_tif_win32.o] Error 1
Run Code Online (Sandbox Code Playgroud)

我找了解决方案的链接,这没有帮助.

也遵循这一点,但得到不同的错误:

c:\mingw\include\stdio.h:345:12: error: expected '=', ',', ';', 'asm' or …
Run Code Online (Sandbox Code Playgroud)

wxwidgets mingw

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

标签 统计

c ×2

mingw ×1

pandas ×1

printf ×1

python-3.x ×1

wxwidgets ×1