WeCodeAcademy

Dates and Counting Values

pd.to_datetime turns text into real dates, and the .dt accessor then gives you parts such as year, month and weekday name. value_counts() counts how often each value appears.

Examplepython
Open in editor »
Quick check

Which accessor gives the month of a datetime column?

Your turn: write the code

Print how many times each city appears (value_counts).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.