~/talk

Times and Dates in Pandas

Talkat PyData Tel Aviv 2024 · 2024-09-25..09-26· [python, web-platform]
slides:none on file

Pandas code converts CSV strings to real datetimes with pd.to_datetime and read_csv(parse_dates=...), shrinking NYC taxi timestamps from ~977 MB as strings to ~250 MB (about 75% less memory). The dt accessor extracts hour/day/month, enabling groupby by hour, value_counts (New Year’s mean trip distance ≈ 3.5 miles), and creating timedeltas by subtracting dropoff − pickup (total_seconds usable, only days/seconds/microseconds stored). Time zones use tz_localize and tz_convert, grouper and resample support chronological bins, and unexpected early 2003 rows can produce NaNs that need dropna.

AI-written summary · about

  1. 0:00Dates and times in pandas
  2. 1:47Datetime vs TimeDelta objects
  3. 3:53Reading CSV with datetime
  4. 7:45Invalid dates with to_datetime
  5. 8:49Ambiguous date formats
  6. 10:53Basic datetime operations
  7. 12:19Sorting and filtering datetimes
  8. 13:24Extracting datetime components
  9. 15:14Trip durations with TimeDelta
  10. 17:26Time zones in pandas
  11. 19:57Grouping by datetime
  12. 21:20Pivot tables with datetime
  13. 22:48Grouping with Grouper
  14. 25:13Indexing TimeSeries data
  15. 26:39Resampling TimeSeries
  16. 27:20Summary of datetime functions
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.