Ah that explains it: if you upgrade to 4.8 you should see your original code work 
Here’s the 4.8 announcement that explains the new features, which are basically what you’re trying to use 📣 Announcing Plotly.py 4.8: Plotly Express Support for Wide- and Mixed-Form Data, plus a Pandas backend