2

I encountered an issue using PyCaret where a

ValueError: Cell is empty

is shown when I tried to create my model. Here is my code:

!pip install pycaret
 
from pycaret.utils import enable_colab 
enable_colab()
import tensorflow as tf
import numpy as np
import pandas as pd

income_data = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/Adult Income/train.csv')
income_data.dropna(inplace=True, axis=0)

from pycaret.classification import *

clf1 = setup(income_data, target = 'income_>50K')
lr = create_model('lr') #Returned error

As you can see from my code, I have already dropped cells with NaN values and during the setup, the summary also showed that I did not have any missing values in my Dataframe. For reference, the dataset I was using can be downloaded here: https://www.kaggle.com/mastmustu/income?select=train.csv

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Jasper Tan
  • 61
  • 4

1 Answers1

2

Got this reply from the Pycaret Github page, which resolved my issue:

Hey, this is an issue with tensorflow. You need to import it after PyCaret:

from pycaret.utils import enable_colab  
enable_colab()
import numpy as np 
import pandas as pd

income_data = pd.read_csv('train.csv')
income_data.dropna(inplace=True, axis=0)

from pycaret.classification import * 
import tensorflow as tf

clf1 = setup(income_data, target = 'income_>50K') lr =
create_model('lr') 

This should work without issues.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Jasper Tan
  • 61
  • 4
  • In the future, please also include a link to the relevant Github issue (added); and you should accept your own answer so that the question shows as resolved and useful to others in the future. – desertnaut Mar 27 '21 at 14:21
  • I had the same issue with `tensorflow` and a combination of `hydra`+`hydra-submitit-plugin`. Solved it the same way by lazily importing `tensorflow`. – Zaccharie Ramzi Jan 05 '22 at 17:20