![](/img/trans.png)
[英]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.