You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a method is passed as column_names, this method should take the number of columns as an argument, and return column names. For example, if I wanted Excel columns like 'AA,AB,AC' instead of agate columns like 'aa,bb,cc', I would be able to pass it this method:
defexcel_column_names(n):
column_names= []
forcol_idxinrange(1, n+1):
# From openpyxl's cell.pyletters= []
whilecol_idx>0:
col_idx, remainder=divmod(col_idx, 26)
# check for exact division and borrow if neededifremainder==0:
remainder=26col_idx-=1letters.append(chr(remainder+64))
column_names.append(''.join(reversed(letters)))
returncolumn_names
The text was updated successfully, but these errors were encountered:
If a method is passed as
column_names
, this method should take the number of columns as an argument, and return column names. For example, if I wanted Excel columns like 'AA,AB,AC' instead of agate columns like 'aa,bb,cc', I would be able to pass it this method:The text was updated successfully, but these errors were encountered: