[英]Filter the data frame based on the column names without using index in pandas
[英]How to add column names to ipysheet without using pandas data frame?
这里我们默认将 A、B 作为列名,如何覆盖列名并编写我们自己的列名
import ipysheet
from ipysheet import sheet, cell
sheet1 = sheet()
cell(0,0,10);
cell(1,1,100);
cell(2,2,1000);
cell(3,3,"Hello");
sheet1
AFAIK 你不能那样做。 ipysheet 不是 Pandas 的替代品,它是一个旨在在 jupyter 中运行的电子表格包。 就像真正的电子表格一样,您无法更改列标题,因为这是您引用事物的方式。 但是,就像在真正的电子表格中一样,您可以在列顶部的单元格中放置一个标题。 你甚至可以让它作为一个“标题”脱颖而出。
如果您不想在 jupyter notebook 中显示数据,您可能不需要 ipysheet。
创建工作表时,您可以为工作表编写自己的列名称。 您可以为此使用column_headers
参数。
在你的情况下:
import ipysheet
from ipysheet import sheet, cell
sheet1 = sheet(column_headers=["Not A", "Not B"])
cell(0,0,10);
cell(1,1,100);
cell(2,2,1000);
cell(3,3,"Hello");
sheet1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.