BaşlayınÜcretsiz Başlayın

Creating a DataFrame

Your last task in this lesson is to create a DataFrame from a dictionary supplied by a zip object. You have to take each single word stored in the list wlist and calculate its length. This data should be stored in two separate tuples that are supplied to the zip() initializer. The resulting zip object should be used to construct a DataFrame where the first column will store words and the second column will store their lengths.

The module pandas is already imported for you as pd.

Bu egzersiz

Practicing Coding Interview Questions in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a list of tuples with words and their lengths
word_lengths = [
    (____, ____) for ____ in wlist for ____ in ____
]
Kodu Düzenle ve Çalıştır