Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Data Science Basics Charts and Tables Line Charts

This series is way too complex. I suggest keeping it simple.

I have had a hell of a time trying to follow this instructor every step of the way throughout this entire series. I have never struggled like I have in this particular series and from this particular instructor. Clearly, she knows her Python and that is great but she needs to know her audience and slim down all of the fancy code-work so the rest of us "Noobs" can follow along. Just make this series more simplified so we can draw the connection in our heads. Please.

Currently, I continue to receive "NameError: name 'get_column_letter' is not defined"

import openpyxl
from openpyxl import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
from s4v1 import *

def save_spreadsheet(filename, data_sample):
    wb = Workbook()
    ws = wb.active

    row_index = 1
    for rows in data_sample:
        col_index = 1
        for field in rows:
            col_letter = get_column_letter(col_index)
            ws.cell('{}{}'.format(col_letter,row_index)).value = field
            col_index += 1
        row_index += 1
    wb.save(filename)

Whenever I use the console, I get the following:

>>> import openpyxl
>>> from openpyxl.cell import get_column_letter
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from openpyxl.cell import get_column_letter
ImportError: cannot import name 'get_column_letter'

Seems there is no method named get_column_letter within the openpyxl module.

Not sure how to proceed from here as this is what the instructor had invoked in her video.

2 Answers

Kent ร…svang
Kent ร…svang
18,823 Points

openpyxl.cell.get_column_letter() has been reallocated to openpyxl.utils.get_column_letter()

I haven't seen these lectures so I can't comment on them any further

stackoverflow

Hope this helped.

I agree, she is writing pretty flawed code all over the place without giving clear commentary of what she is doing.