import
try-except
cupy
cupyx
why is that ? not sure it is best practice, but I tend to use try except block to avoid inference errors.
Sorry for the confusion, the try-except warning is only for import statements, not regular code.
Especially for such situation:
try: import pandas except ImportError: %pip install pandas import pandas
There is more details in the documentation:
Importing at a level other than the very top level will not work. Wrapping it in a try-except or if-else statement will generate a warning. The import will be ignored. Imports in functions are also ignored but do not generate warnings.
if-else