Helper_functions, display_table

When creating a post, please add:

  • Module # must be added in the tags option of the post. (ex: Module-1)
  • Link to the classroom item you are referring to:
  • Description (include relevant info but please do not post solution code or your entire notebook)

running code in own setup.
imported helper_functions, which contains display_table
When called, with csv file contents as param
I see
<IPython.core.display.HTML object>

I can’t see what I’m missing?
Suggestions please.

Hi @DPawson,

Please share the following:

  • Name of the module and name of the lesson which you are referring to.
  • For running it on your own setup, have you taken the files from Coursera or the DLAI’s learning platform? And which files have you downloaded? Name all of them.
  • Share a screenshot of the code you are trying to run, including the output you are seeing.

Thanks,
Mubsi

Hi DPawson,
your description of the problem is not very clear. I can only guess that you might have a problem with helper_functions.
display_table in helper_functions needs

import pandas as pd
from IPython.display import display, HTML

Maybe helper_functions in your local environment is not working. You must also install pandas.

1 Like

No module / lesson, using my own code
Downloaded helper_functions.py from coursera (why isn’t there a complete version available please?
imports
from openai import OpenAI
from helper_functions import get_llm_response, print_llm_response, display_table
from IPython.display import Markdown
import csv
import os, sys
Dict created from my own csv file,
then attempt to show it

Read the .csv file

temps = read_csv(“siba.csv”)

Display the itinerary

display_table(temps)

output

/data/files/ai/aipython 14:59 > python sibatemp.py
<IPython.core.display.HTML object>

Hi @DPawson,

I’m not sure what you mean by “complete” here ? Everything is completely present on Coursera (and the Learning Platform), which is why everything runs there. If it wasn’t complete, there would be errors.

Just in case, download the helper_functions.py file from the last lesson of module 3.

Make sure you have the pandas version 1.5.0 and ipython version 8.5.0 installed, as these are ones being used.

pandas==1.5.0
ipython==8.5.0

Let me know how this goes.

Best,
Mubsi

It would appear that the various helper_function files differ in their content.
Each runs in the module, agreed.

My ipython is 8.26.0
pandas 2.2.1

Could be an issue there.
Ah well. I’ll find an alternative.

1 Like

Hi @DPawson,

A follow up question, when running locally, are you using a Jupyter notebook?

No, running from commandline using python.

Hi @DPawson,

That is the issue. The function is supposed to run in a Jupyter notebook.

Command-line won’t be able to display that.

1 Like