Hello, I am experiencing a bug using cards in note...
# ask-metaflow
p
Hello, I am experiencing a bug using cards in notebooks. Here is how I create a card:
Copy code
@card(type='blank')
    @step
    def fetch_dataset(self):
        self.dataset = fetch() # fetch from url, returns a pd.DataFrame
        current.card.append(Markdown("# Input dataset"))
        current.card.append(Table(self.dataset))
Then when I do
Copy code
from metaflow.cards import get_cards
get_cards(flow_name + '/' + Flow(flow_name).latest_run.id + '/fetch_dataset/2')[0]
it shows only "*Input dataset*" and then an empty frame that seems to grow indefinitely. Edit: I tried updating my code to see what would happen:
Copy code
current.card.append(Table([[1,2,3,4], [1,2,3,4]]))
This time the table is displayed, but it still grows the white frame indefinitely below the table. FYI I am running Jupyter Notebook in VScode.
h
can you change the line like this :
Copy code
current.card.append(Table.from_dataframe(self.dataset))
🙌 1
basically the
Table
object has a from_dataframe method that helps with this.
🙌 1
p
thank you I will try it right now
Now the dataframe is displayed, thank you. But there is still this bug with a ever growing white space at the bottom of the card
h
Can you share some screen shots ? Would help debug the issue. Can you also share your browser ? Would help reproduce the issue
p
Hum, I can share a screenshot but I am not sure it will help you a lot. But I will see if I can get something that shows the problem. I am not in a browser however, I am using Jupyter Notebook in VScode, it may be the problem
thankyou 1
I am showing the cursor to give you an idea of the amount of white space generated
b
@powerful-dress-75267 are you able to access the HTML file for the card? Are you willing to share it?
s
I also see the same behaviour in VScode, coupled with the card whitespace flashing at very high frequency which is a bit 🤮 Have attached a sample HTML file, but there is no issue opening it in a browser, so I suspect this is a VScode bug rather than an issue with Cards
b
Thanks @stale-salesmen-66018 - I will see if I can reproduce
👍 1
@stale-salesmen-66018 can you share a screenshot of how it looks for you in vscode?
s
very much similar to what @powerful-dress-75267 shared - this is with output collapsed vs. not to give some contrast to the size of the scrollbar (to give a feel for the amount of whitespace)
b