DA27. 统一最后刷题日期的格式
描述
Python 3 解法, 执行用时: 794ms, 内存消耗: 524288KB, 提交时间: 2022-07-25
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv',sep=',',dtype=object) Nowcoder['Last_submission_time'] = pd.to_datetime(Nowcoder["Last_submission_time"],format="%Y-%m-%d") print(Nowcoder[['Nowcoder_ID','Level','Last_submission_time']])
Python 3 解法, 执行用时: 801ms, 内存消耗: 524288KB, 提交时间: 2022-07-21
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv',sep=',', dtype=object) pd.set_option('display.width', 300) # 设置字符显示宽度 pd.set_option('display.max_rows', None) # 设置显示最大行 pd.set_option('display.max_columns', None) Nowcoder['Last_submission_time'] = pd.to_datetime(Nowcoder['Last_submission_time']).\ dt.strftime('%Y-%m-%d') print(Nowcoder[['Nowcoder_ID','Level','Last_submission_time']])
Python 3 解法, 执行用时: 804ms, 内存消耗: 524288KB, 提交时间: 2022-07-24
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv',sep = ',',dtype = object) Nowcoder['Last_submission_time'] = pd.to_datetime(Nowcoder['Last_submission_time'], format = '%Y-%m-%d') print(Nowcoder[['Nowcoder_ID','Level','Last_submission_time']])
Python 3 解法, 执行用时: 806ms, 内存消耗: 524288KB, 提交时间: 2022-07-21
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv',sep=',',dtype=object) Nowcoder['Last_submission_time']=pd.to_datetime(Nowcoder['Last_submission_time'],format='%Y-%m-%d') print(Nowcoder[['Nowcoder_ID','Level','Last_submission_time']])
Python 3 解法, 执行用时: 809ms, 内存消耗: 524288KB, 提交时间: 2022-08-03
import pandas as pd df = pd.read_csv('Nowcoder.csv', sep=',', dtype=object) df['Last_submission_time'] = pd.to_datetime(df.Last_submission_time) df['Last_submission_time'] = df['Last_submission_time'].dt.strftime('%Y-%m-%d') r = df[['Nowcoder_ID','Level','Last_submission_time']] print(r)