Skip to content

Instantly share code, notes, and snippets.

@Holt59
Created October 1, 2018 10:08
Show Gist options
  • Save Holt59/7eab90ff671c4a99c899ad92bd7e2a94 to your computer and use it in GitHub Desktop.
Save Holt59/7eab90ff671c4a99c899ad92bd7e2a94 to your computer and use it in GitHub Desktop.
Pandas multicolumns dates
import io
import pandas as pd
s = """something a b c d message month day year
one 1 2 3.0 4 NaN 10 10 2018
two 5 6 NaN 8 world 10 16 2018
three 9 10 11.0 12 foo 11 15 2018"""
print(pd.read_table(io.StringIO(s), sep=' ', parse_dates={'date': ['month', 'day', 'year']}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment