import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style='whitegrid',palette='deep')
# 读取标普500指数和富时100指数数据
df_spx500_and_ftse100 = pd.read_csv('line_chart_data.csv')
# 预览数据样式
df_spx500_and_ftse100.head(5)
# 此时的Date列为字符串,由于下面需要进行日期比较,所以需要将字符格式转为datetime格式
# 数据处理:字符 >> 日期格式(通过pd.to_datetime()实现)
df_spx500_and_ftse100['Date'] = pd.to_datetime(df_spx500_and_ftse100['Date'])
# 预览格式转换后的结果
df_spx500_and_ftse100.head(5)
#