import pandas as pd
print("数据1")
grades_df1 = pd.DataFrame(data=
{'日期': ["2022-01-01", "2022-01-02", "2022-01-03", "2022-01-04", "2022-01-05", "2022-01-06", "2022-01-07", "2022-01-08", "2022-01-10","2022-01-11"],
'exam1': [24, 63, 56, 56, 67, 51, 79, 46, 72, 60]})
print(grades_df1)
print(type(grades_df1))
"""
数据1
日期 exam1
0 2022-01-01 24
1 2022-01-02 63
2 2022-01-03 56
3 2022-01-04 56
4 2022-01-05 67
5 2022-01-06 51
6 2022-01-07 79
7 2022-01-08 46
8 2022-01-10 72
9 2022-01-11 60
<class 'pandas.core.frame.DataFrame'>
"""
print("数据2")
grades_df2 = pd.DataFrame(data=
{'日期': ["2022-01-01", "2022-01-02", "2022-01-03", "2022-01-04", "2022-01-05", "2022-01-06", "2022-01-07", "2022-01-08", "2022-01-09","2022-10-01"],
'exam2': [24, 63, 56, 56, 67, 51, 79, 46, 7, 60]})
print(grades_df2)
print(type(grades_df2))
print("数据2")
"""
数据2
日期 exam2
0 2022-01-01 24
1 2022-01-02 63
2 2022-01-03 56
3 2022-01-04 56
4 2022-01-05 67
5 2022-01-06 51
6 2022-01-07 79
7 2022-01-08 46
8 2022-01-09 7
9 2022-10-01 60
<class 'pandas.core.frame.DataFrame'>
"""
# 希望的结果
"""
日期 exam1
0 2022-01-01 24
1 2022-01-02 63
2 2022-01-03 56
3 2022-01-04 56
4 2022-01-05 67
5 2022-01-06 51
6 2022-01-07 79
7 2022-01-08 46
8 2022-10-01 60
9 2022-01-10 72
10 2022-10-11 60
<class 'pandas.core.frame.DataFrame'>
"""
'''
实际数据为多个数据集设置使用动态变量两两合并, 每个数据集都含有多个列, 代码尽量不要太多,太繁琐.
'''
##谢谢


雷达卡









京公网安备 11010802022788号







