擅长:python、mysql、java
<pre class="lang-py prettyprint-override"><code>
s= """3434 9/17/2018 5:19
3434 9/17/2018 5:57
3456 9/17/2018 5:58
3457 9/17/2018 5:59
3234 9/17/2018 6:00
3457 9/17/2018 6:07
3459 9/17/2018 6:20
3434 9/20/2018 9:35
3434 9/20/2018 9:35
3456 9/20/2018 9:41
3457 9/20/2018 9:41
3234 9/20/2018 9:43
3457 9/20/2018 9:46
3459 9/20/2018 9:46
3434 9/20/2018 9:51
3434 9/20/2018 9:52
3456 9/20/2018 9:52"""
raw = [row.split(" ") for row in s.split("\n")]
df = pd.DataFrame(raw, columns=["card", "time"])
df["time"] = pd.to_datetime(df.time)
df["date"] = df["time"].dt.date
## this will also keep time columns with minimum time
df.groupby(["card", "date"]).min().reset_index(level=1)
</code></pre>