Error importing dtreeviz

Asked 1 years ago, Updated 1 years ago, 415 views

I would like to import dtreeviz with the following code.

 from dtreeviz.trees import dtreeviz

When you try, you get the following error:

cannot import name 'dtreeviz' from 'dtreeviz.trees'

Graphviz is installed and the path is configured.

I am using Windows 11.

python python3

2023-01-31 08:33

1 Answers

I answered the following questions together, but it seems that the specifications have changed due to the revision of dtreeviz.
Releases/2.0.0 has old and new statements, and it seems recommended that the new API only use a single import without from.

import dtreeviz

It seems that the following methods are included to ensure compatibility as much as possible, but it would be better to use the above to match the latest version.

from dtreeviz import*


2023-01-31 08:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.