# Buggy code
def __init__(self, parent):
    QWidget.__init__(self, parent)

    vert_layout = QVBoxLayout()

    # Type frame
    type_layout = QHBoxLayout()
    type_label = QLabel(_("Import as"))
    type_layout.addWidget(type_label)

    self.array_btn = array_btn = QRadioButton(_("array"))
    array_btn.setEnabled(ndarray is not FakeObject)
    array_btn.setChecked(ndarray is not FakeObject)
    type_layout.addWidget(array_btn)

    list_btn = QRadioButton(_("list"))
    list_btn.setChecked(not array_btn.isChecked())
    type_layout.addWidget(list_btn)

    if pd:
        self.df_btn = df_btn = QRadioButton(_("DataFrame"))
        df_btn.setChecked(False)
        type_layout.addWidget(df_btn)

    h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
    type_layout.addItem(h_spacer)
    type_frame = QFrame()
    type_frame.setLayout(type_layout)

    self._table_view = PreviewTable(self)
    vert_layout.addWidget(type_frame)
    vert_layout.addWidget(self._table_view)
    self.setLayout(vert_layout)


# Traceback (ImportError)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 576, in _set_step
self.text_widget.get_comments())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 478, in open_data
skiprows, comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 411, in process_data
comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 391, in _shape_text
from numpy import nan
ImportError: cannot import name 'nan' from 'numpy' (unknown location)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 576, in _set_step
self.text_widget.get_comments())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 478, in open_data
skiprows, comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 411, in process_data
comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 391, in _shape_text
from numpy import nan
ImportError: cannot import name 'nan' from 'numpy' (unknown location)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 576, in _set_step
self.text_widget.get_comments())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 478, in open_data
skiprows, comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 411, in process_data
comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 391, in _shape_text
from numpy import nan
ImportError: cannot import name 'nan' from 'numpy' (unknown location)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 576, in _set_step
self.text_widget.get_comments())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 478, in open_data
skiprows, comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 411, in process_data
comments)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\importwizard.py", line 391, in _shape_text
from numpy import nan
ImportError: cannot import name 'nan' from 'numpy' (unknown location)

# Fixed code
def __init__(self, parent):
    QWidget.__init__(self, parent)

    vert_layout = QVBoxLayout()

    # Type frame
    type_layout = QHBoxLayout()
    type_label = QLabel(_("Import as"))
    type_layout.addWidget(type_label)

    self.array_btn = array_btn = QRadioButton(_("array"))
    available_array = not isinstance(ndarray, FakeObject) and not isinstance(
        array, FakeObject
    )
    array_btn.setEnabled(available_array)
    array_btn.setChecked(available_array)
    type_layout.addWidget(array_btn)

    list_btn = QRadioButton(_("list"))
    list_btn.setChecked(not array_btn.isChecked())
    type_layout.addWidget(list_btn)

    if pd:
        self.df_btn = df_btn = QRadioButton(_("DataFrame"))
        df_btn.setChecked(False)
        type_layout.addWidget(df_btn)

    h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
    type_layout.addItem(h_spacer)
    type_frame = QFrame()
    type_frame.setLayout(type_layout)

    self._table_view = PreviewTable(self)
    vert_layout.addWidget(type_frame)
    vert_layout.addWidget(self._table_view)
    self.setLayout(vert_layout)