简体   繁体   中英

How to add column names to ipysheet without using pandas data frame?

Here we are getting by default A,B as column names, how to override column names and write our own column names

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 you can't do that. ipysheet isn't a pandas replacement, it's a spreadsheet package designed to run in jupyter. Just like a real spreadsheet, you can't change the column headings because this is how you reference things . However, like in a real spreadsheet, you can put a heading in the cell at the top of a column. And you can even make it stand out as a 'heading'.

If you don't want to display your data in a jupyter notebook you probably don't want ipysheet.

References

https://github.com/QuantStack/ipysheet

You can write your own column names for a sheet when you are creating it. You can use the column_headers argument for this.

In your case:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM