做网站的公司地址,网站无法打开网页是怎么回事,wordpress 禁止目录浏览,制作可以赚钱的网站目录
一、用法精讲
276、pandas.Series.dt.is_quarter_start属性
276-1、语法
276-2、参数
276-3、功能
276-4、返回值
276-5、说明
276-6、用法
276-6-1、数据准备
276-6-2、代码示例
276-6-3、结果输出
277、pandas.Series.dt.is_quarter_end属性
277-1、语法
…目录
一、用法精讲
276、pandas.Series.dt.is_quarter_start属性
276-1、语法
276-2、参数
276-3、功能
276-4、返回值
276-5、说明
276-6、用法
276-6-1、数据准备
276-6-2、代码示例
276-6-3、结果输出
277、pandas.Series.dt.is_quarter_end属性
277-1、语法
277-2、参数
277-3、功能
277-4、返回值
277-5、说明
277-6、用法
277-6-1、数据准备
277-6-2、代码示例
277-6-3、结果输出
278、pandas.Series.dt.is_year_start属性
278-1、语法
278-2、参数
278-3、功能
278-4、返回值
278-5、说明
278-6、用法
278-6-1、数据准备
278-6-2、代码示例
278-6-3、结果输出
279、pandas.Series.dt.is_year_end属性
279-1、语法
279-2、参数
279-3、功能
279-4、返回值
279-5、说明
279-6、用法
279-6-1、数据准备
279-6-2、代码示例
279-6-3、结果输出
280、pandas.Series.dt.is_leap_year属性
280-1、语法
280-2、参数
280-3、功能
280-4、返回值
280-5、说明
280-6、用法
280-6-1、数据准备
280-6-2、代码示例
280-6-3、结果输出
二、推荐阅读
1、Python筑基之旅
2、Python函数之旅
3、Python算法之旅
4、Python魔法之旅
5、博客个人主页 一、用法精讲
276、pandas.Series.dt.is_quarter_start属性
276-1、语法
# 276、pandas.Series.dt.is_quarter_start属性
pandas.Series.dt.is_quarter_start
Indicator for whether the date is the first day of a quarter.Returns:
is_quarter_start
Series or DatetimeIndex
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
276-2、参数 无
276-3、功能 用于检查日期时间索引是否是季度开始的属性这在处理时间序列数据时非常有用。
276-4、返回值 返回一个布尔值的序列指示时间序列中的每个日期是否为季度开始。
276-5、说明 使用场景
276-5-1、财务报表分析在财务分析中公司通常会根据季度进行报告。这使得识别每个季度的起始日期变得非常重要以便分析每个季度的表现。例如通过标记季度的开始分析师可以轻松地比较不同季度的财务数据例如收入、支出和利润。
276-5-2、销售数据分析销售数据往往具有季节性特点季度开始可能意味着新的销售周期的开始。例如分析销售趋势时识别季度开始以判断季度销售策略的有效性。
276-5-3、经济数据分析经济数据如GDP、失业率等通常按季度发布因此在分析时需要识别和提取季度起始数据。例如比较不同季度的经济指标以评估经济增长或衰退的情况。
276-5-4、项目管理在项目管理中特别是涉及跨季度的项目时识别季度开始可以帮助项目经理更好地计划和分配资源。例如根据季度开始调整项目资源和预算。
276-5-5、投资组合分析在投资领域许多投资策略和分析都是基于季度进行的识别季度开始有助于进行投资组合的分析和调整。例如在季度开始时进行投资组合的再平衡以优化收益。
276-6、用法
276-6-1、数据准备
无
276-6-2、代码示例
# 276、pandas.Series.dt.is_quarter_start属性
# 276-1、财务报表分析
import pandas as pd
# 示例数据公司每月的收入
date_range pd.date_range(start2023-01-01, periods12, freqMS)
revenue [10000, 12000, 11000, 15000, 14000, 13000, 16000, 17000, 16500, 18000, 17500, 19000]
df pd.DataFrame({date: date_range, revenue: revenue})
df.set_index(date, inplaceTrue)
# 标记季度开始
df[is_quarter_start] df.index.to_series().dt.is_quarter_start
# 过滤出季度开始的数据
quarterly_revenue df[df[is_quarter_start]]
print(quarterly_revenue, end\n\n)# 276-2、销售数据分析
import pandas as pd
# 示例数据每月销售量
date_range pd.date_range(start2023-01-01, periods12, freqMS)
sales [500, 600, 550, 700, 650, 620, 750, 770, 760, 800, 790, 810]
df pd.DataFrame({date: date_range, sales: sales})
df.set_index(date, inplaceTrue)
# 标记季度开始
df[is_quarter_start] df.index.to_series().dt.is_quarter_start
# 筛选季度开始的销售数据
quarterly_sales df[df[is_quarter_start]]
print(quarterly_sales, end\n\n)# 276-3、经济数据分析
import pandas as pd
# 示例数据每月GDP增长率
date_range pd.date_range(start2023-01-01, periods12, freqMS)
gdp_growth [0.3, 0.4, 0.2, 0.5, 0.4, 0.35, 0.45, 0.5, 0.48, 0.55, 0.52, 0.6]
df pd.DataFrame({date: date_range, gdp_growth: gdp_growth})
df.set_index(date, inplaceTrue)
# 标记季度开始
df[is_quarter_start] df.index.to_series().dt.is_quarter_start
# 筛选季度开始的数据
quarterly_gdp_growth df[df[is_quarter_start]]
print(quarterly_gdp_growth, end\n\n)# 276-4、项目管理
import pandas as pd
# 示例数据项目进度每月完成的任务数量
date_range pd.date_range(start2023-01-01, periods12, freqMS)
tasks_completed [10, 15, 12, 18, 16, 14, 20, 22, 21, 25, 23, 27]
df pd.DataFrame({date: date_range, tasks_completed: tasks_completed})
df.set_index(date, inplaceTrue)
# 标记季度开始
df[is_quarter_start] df.index.to_series().dt.is_quarter_start
# 筛选季度开始的项目数据
quarterly_tasks df[df[is_quarter_start]]
print(quarterly_tasks, end\n\n)# 276-5、投资组合分析
import pandas as pd
# 示例数据每月投资组合收益率
date_range pd.date_range(start2023-01-01, periods12, freqMS)
returns [0.02, 0.03, 0.025, 0.04, 0.035, 0.03, 0.045, 0.05, 0.048, 0.055, 0.052, 0.06]
df pd.DataFrame({date: date_range, returns: returns})
df.set_index(date, inplaceTrue)
# 标记季度开始
df[is_quarter_start] df.index.to_series().dt.is_quarter_start
# 筛选季度开始的投资收益率数据
quarterly_returns df[df[is_quarter_start]]
print(quarterly_returns)
276-6-3、结果输出
# 276、pandas.Series.dt.is_quarter_start属性
# 276-1、财务报表分析
# revenue is_quarter_start
# date
# 2023-01-01 10000 True
# 2023-04-01 15000 True
# 2023-07-01 16000 True
# 2023-10-01 18000 True# 276-2、销售数据分析
# sales is_quarter_start
# date
# 2023-01-01 500 True
# 2023-04-01 700 True
# 2023-07-01 750 True
# 2023-10-01 800 True# 276-3、经济数据分析
# gdp_growth is_quarter_start
# date
# 2023-01-01 0.30 True
# 2023-04-01 0.50 True
# 2023-07-01 0.45 True
# 2023-10-01 0.55 True# 276-4、项目管理
# tasks_completed is_quarter_start
# date
# 2023-01-01 10 True
# 2023-04-01 18 True
# 2023-07-01 20 True
# 2023-10-01 25 True# 276-5、投资组合分析
# returns is_quarter_start
# date
# 2023-01-01 0.020 True
# 2023-04-01 0.040 True
# 2023-07-01 0.045 True
# 2023-10-01 0.055 True
277、pandas.Series.dt.is_quarter_end属性
277-1、语法
# 277、pandas.Series.dt.is_quarter_end属性
pandas.Series.dt.is_quarter_end
Indicator for whether the date is the last day of a quarter.Returns:
is_quarter_end
Series or DatetimeIndex
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
277-2、参数 无
277-3、功能 用于检查日期时间对象是否落在季度的最后一天。
277-4、返回值 返回一个布尔型的pandas.Series对象其中每个元素是一个布尔值如果该日期是季度的最后一天则返回True否则返回False。
277-5、说明 使用场景
277-5-1、财务报告在财务数据处理中季度末通常是报告的关键日期使用该属性可以帮助确定每个季度的结束日期以便生成季度财务报告、进行季度结算和审计。
277-5-2、季度分析分析季度销售额、季度利润或季度业绩时需要知道哪些日期属于季度末这样可以方便地将数据按季度进行分组和比较。
277-5-3、时间序列分析在时间序列分析中确定数据的季度末点对于预测和模型验证很重要可以利用该属性识别和标记这些关键日期以进行特殊处理或建模。
277-5-4、投资组合管理在投资领域季度末通常是重新平衡投资组合、计算回报率和评估绩效的时间点通过识别季度末日期可以进行相关的投资操作和分析。
277-5-5、预算和计划企业和组织通常以季度为单位制定预算和计划使用该属性可以帮助确定预算周期的结束日期以便进行预算跟踪和调整。
277-5-6、数据可视化在数据可视化中可以利用季度末标记突出显示关键时间点。例如在时间序列图中可以将季度末用不同颜色或标记表示以便更直观地展示数据的季度变化。
277-6、用法
277-6-1、数据准备
无
277-6-2、代码示例
# 277、pandas.Series.dt.is_quarter_end属性
# 277-1、财务报告
import pandas as pd
# 生成示例财务数据
date_range pd.date_range(start2022-01-01, end2023-12-31, freqME)
revenue [100, 150, 120, 130, 180, 170, 160, 140, 200, 190, 210, 220] * 2
df pd.DataFrame({date: date_range, revenue: revenue})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 筛选出季度末的数据
quarter_end_report df[df[is_quarter_end]]
print(quarter_end_report, end\n\n)# 277-2、季度分析
import pandas as pd
import numpy as np
# 生成示例销售数据
date_range pd.date_range(start2023-01-01, end2023-12-31, freqD)
sales np.random.randint(50, 200, len(date_range))
df pd.DataFrame({date: date_range, sales: sales})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 计算季度总销售额
quarterly_sales df[df[is_quarter_end]].resample(QE).sum()
print(quarterly_sales, end\n\n)# 277-3、时间序列分析
import pandas as pd
import numpy as np
# 生成示例时间序列数据
date_range pd.date_range(start2023-01-01, end2023-12-31, freqD)
values np.random.randn(len(date_range))
df pd.DataFrame({date: date_range, value: values})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 识别并标记季度末点
df[quarter_end_value] df[value].where(df[is_quarter_end])
print(df, end\n\n)# 277-4、投资组合管理
import pandas as pd
import numpy as np
# 生成示例投资组合数据
date_range pd.date_range(start2022-01-01, end2023-12-31, freqB)
portfolio_value np.cumsum(np.random.randn(len(date_range))) 1000
df pd.DataFrame({date: date_range, portfolio_value: portfolio_value})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 筛选出季度末的投资组合价值
quarter_end_portfolio df[df[is_quarter_end]]
print(quarter_end_portfolio, end\n\n)# 277-5、预算和计划
import pandas as pd
# 生成示例预算数据
date_range pd.date_range(start2023-01-01, end2023-12-31, freqME)
budget [10000, 12000, 11000, 11500, 13000, 12500, 14000, 13500, 14500, 15000, 15500, 16000]
df pd.DataFrame({date: date_range, budget: budget})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 筛选出季度末的预算数据
quarter_end_budget df[df[is_quarter_end]]
print(quarter_end_budget, end\n\n)# 277-6、数据可视化
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# 生成示例数据
date_range pd.date_range(start2023-01-01, end2023-12-31, freqD)
values np.random.randn(len(date_range))
df pd.DataFrame({date: date_range, value: values})
# 设置日期为索引
df.set_index(date, inplaceTrue)
# 添加季度末标记
df[is_quarter_end] df.index.to_series().dt.is_quarter_end
# 生成时间序列图
plt.figure(figsize(10, 6))
plt.plot(df.index, df[value], labelDaily Values)
plt.scatter(df[df[is_quarter_end]].index, df[df[is_quarter_end]][value], colorred, labelQuarter End, zorder5)
plt.title(Daily Values with Quarter End Highlights)
plt.xlabel(Date)
plt.ylabel(Value)
plt.legend()
plt.show()
277-6-3、结果输出
# 277、pandas.Series.dt.is_quarter_end属性
# 277-1、财务报告
# revenue is_quarter_end
# date
# 2022-03-31 120 True
# 2022-06-30 170 True
# 2022-09-30 200 True
# 2022-12-31 220 True
# 2023-03-31 120 True
# 2023-06-30 170 True
# 2023-09-30 200 True
# 2023-12-31 220 True# 277-2、季度分析
# sales is_quarter_end
# date
# 2023-03-31 199 1
# 2023-06-30 106 1
# 2023-09-30 135 1
# 2023-12-31 145 1# 277-3、时间序列分析
# value is_quarter_end quarter_end_value
# date
# 2023-01-01 1.134182 False NaN
# 2023-01-02 -0.246785 False NaN
# 2023-01-03 -0.924551 False NaN
# 2023-01-04 -0.072634 False NaN
# 2023-01-05 1.326382 False NaN
# ... ... ... ...
# 2023-12-27 -0.511110 False NaN
# 2023-12-28 -1.399089 False NaN
# 2023-12-29 -0.159974 False NaN
# 2023-12-30 0.643342 False NaN
# 2023-12-31 0.399300 True 0.3993
#
# [365 rows x 3 columns]# 277-4、投资组合管理
# portfolio_value is_quarter_end
# date
# 2022-03-31 999.132484 True
# 2022-06-30 991.091731 True
# 2022-09-30 992.471551 True
# 2023-03-31 999.789461 True
# 2023-06-30 994.793638 True# 277-5、预算和计划
# budget is_quarter_end
# date
# 2023-03-31 11000 True
# 2023-06-30 12500 True
# 2023-09-30 14500 True
# 2023-12-31 16000 True# 277-6、数据可视化
# 见图1图1 278、pandas.Series.dt.is_year_start属性
278-1、语法
# 278、pandas.Series.dt.is_year_start属性
pandas.Series.dt.is_year_start
Indicate whether the date is the first day of a year.Returns:
Series or DatetimeIndex
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
278-2、参数 无
278-3、功能 用于检查Series中的每个时间戳是否是该年的第一天(即1月1日)。
278-4、返回值 返回一个布尔类型的Series其中每个元素表示对应时间戳是否为该年的第一天具体来说如果某个时间戳是1月1日则对应的值为True否则为False。
278-5、说明 使用场景
278-5-1、筛选特定日期在时间序列数据中筛选出每年开始的日期。
278-5-2、标记事件标记时间序列数据中的特定日期以便后续分析。
278-5-3、数据分组按每年的开始日期进行数据分组和聚合。
278-6、用法
278-6-1、数据准备
无
278-6-2、代码示例
# 278、pandas.Series.dt.is_year_start属性
# 278-1、筛选每年开始的日期
import pandas as pd
# 创建包含日期的Series
dates pd.Series(pd.date_range(2020-01-01, 2024-07-31, freqD))
# 筛选每年开始的日期
year_start_dates dates[dates.dt.is_year_start]
print(year_start_dates, end\n\n)# 278-2、标记每年开始的日期
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2020-01-01, 2023-12-31, freqD),value: range(1461)
})
# 标记每年开始的日期
data[is_year_start] data[date].dt.is_year_start
print(data.head(10), end\n\n)# 278-3、按每年开始的日期进行数据分组和聚合
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2020-01-01, 2023-12-31, freqD),value: range(1461)
})
# 添加每年开始的标记这一步实际上对于计算整年总值不是必需的
data[is_year_start] data[date].dt.is_year_start
# 按年份进行分组并计算每年的value总和
grouped_data data.groupby(data[date].dt.year)[value].sum().reset_index()
print(grouped_data)
278-6-3、结果输出
# 278、pandas.Series.dt.is_year_start属性
# 278-1、筛选每年开始的日期
# 0 2020-01-01
# 366 2021-01-01
# 731 2022-01-01
# 1096 2023-01-01
# 1461 2024-01-01
# dtype: datetime64[ns]# 278-2、标记每年开始的日期
# date value is_year_start
# 0 2020-01-01 0 True
# 1 2020-01-02 1 False
# 2 2020-01-03 2 False
# 3 2020-01-04 3 False
# 4 2020-01-05 4 False
# 5 2020-01-06 5 False
# 6 2020-01-07 6 False
# 7 2020-01-08 7 False
# 8 2020-01-09 8 False
# 9 2020-01-10 9 False# 278-3、按每年开始的日期进行数据分组和聚合
# date value
# 0 2020 66795
# 1 2021 200020
# 2 2022 333245
# 3 2023 466470
279、pandas.Series.dt.is_year_end属性
279-1、语法
# 279、pandas.Series.dt.is_year_end属性
pandas.Series.dt.is_year_end
Indicate whether the date is the last day of the year.Returns:
Series or DatetimeIndex
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
279-2、参数 无
279-3、功能 用于检查每个日期是否为一年中的最后一天的属性。
279-4、返回值 返回一个布尔型的Series用于标识日期是否为每年的结束。
279-5、说明 使用场景
279-5-1、筛选特定日期在时间序列数据中筛选出每年结束的日期。
279-5-2、标记事件标记时间序列数据中的特定日期以便后续分析。
279-5-3、数据分组按每年的结束日期进行数据分组和聚合。
279-6、用法
279-6-1、数据准备
无
279-6-2、代码示例
# 279、pandas.Series.dt.is_year_end属性
# 279-1、筛选每年结束的日期
import pandas as pd
# 创建包含日期的Series
dates pd.Series(pd.date_range(2020-01-01, 2023-12-31, freqD))
# 筛选每年结束的日期
year_end_dates dates[dates.dt.is_year_end]
print(year_end_dates, end\n\n)# 279-2、标记每年结束的日期
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2020-01-01, 2023-12-31, freqD),value: range(1461)
})
# 标记每年结束的日期
data[is_year_end] data[date].dt.is_year_end
print(data.head(10), end\n\n)# 279-3、按每年结束的日期进行数据分组和聚合
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2020-01-01, 2023-12-31, freqD),value: range(1461)
})
# 添加每年结束的标记这一步实际上对于计算整年总值不是必需的
data[is_year_end] data[date].dt.is_year_end
# 按年份进行分组并计算每年的value总和
grouped_data data.groupby(data[date].dt.year)[value].sum().reset_index()
print(grouped_data)
279-6-3、结果输出
# 279、pandas.Series.dt.is_year_end属性
# 279-1、筛选每年结束的日期
# 365 2020-12-31
# 730 2021-12-31
# 1095 2022-12-31
# 1460 2023-12-31
# dtype: datetime64[ns]# 279-2、标记每年结束的日期
# date value is_year_end
# 0 2020-01-01 0 False
# 1 2020-01-02 1 False
# 2 2020-01-03 2 False
# 3 2020-01-04 3 False
# 4 2020-01-05 4 False
# 5 2020-01-06 5 False
# 6 2020-01-07 6 False
# 7 2020-01-08 7 False
# 8 2020-01-09 8 False
# 9 2020-01-10 9 False# 279-3、按每年结束的日期进行数据分组和聚合
# date value
# 0 2020 66795
# 1 2021 200020
# 2 2022 333245
# 3 2023 466470
280、pandas.Series.dt.is_leap_year属性
280-1、语法
# 280、pandas.Series.dt.is_leap_year属性
pandas.Series.dt.is_leap_year
Boolean indicator if the date belongs to a leap year.A leap year is a year, which has 366 days (instead of 365) including 29th of February as an intercalary day. Leap years are years which are multiples of four with the exception of years divisible by 100 but not by 400.Returns:
Series or ndarray
Booleans indicating if dates belong to a leap year.
280-2、参数 无
280-3、功能 用于检查日期是否在闰年中的属性。
280-4、返回值 返回一个布尔型的Series用于标识每个日期所在的年份是否为闰年。
280-5、说明 使用场景
280-5-1、筛选闰年数据在时间序列数据中筛选出闰年的数据。
280-5-2、数据分析分析闰年与非闰年的数据差异。
280-5-3、数据可视化对闰年和非闰年的数据进行区分和可视化。
280-6、用法
280-6-1、数据准备
无
280-6-2、代码示例
# 280、pandas.Series.dt.is_leap_year属性
# 280-1、筛选闰年中的日期
import pandas as pd
# 创建包含日期的Series
dates pd.Series(pd.date_range(2018-01-01, 2023-12-31, freqD))
# 筛选闰年中的日期
leap_year_dates dates[dates.dt.is_leap_year]
print(闰年中的日期)
print(leap_year_dates, end\n\n)# 280-2、标记闰年日期
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2018-01-01, 2023-12-31, freqD),value: range(2191)
})
# 标记闰年中的日期
data[is_leap_year] data[date].dt.is_leap_year
print(标记闰年日期的数据前十行)
print(data.head(10), end\n\n)# 280-3、统计闰年和非闰年的数据
import pandas as pd
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2018-01-01, 2023-12-31, freqD),value: range(2191)
})
# 添加闰年的标记
data[is_leap_year] data[date].dt.is_leap_year
# 统计闰年和非闰年的数据
leap_year_data data[data[is_leap_year]]
non_leap_year_data data[~data[is_leap_year]]
print(闰年数据总和:, leap_year_data[value].sum())
print(非闰年数据总和:, non_leap_year_data[value].sum(), end\n\n)# 280-4、可视化闰年和非闰年的数据
import pandas as pd
import matplotlib.pyplot as plt
# 创建包含日期的DataFrame
data pd.DataFrame({date: pd.date_range(2018-01-01, 2023-12-31, freqD),value: range(2191) # 一些示例数据
})
# 添加闰年的标记
data[is_leap_year] data[date].dt.is_leap_year
# 统计每年的数据总和
yearly_data data.groupby(data[date].dt.year)[value].sum()
# 标记闰年
leap_years yearly_data[yearly_data.index.to_series().apply(lambda x: pd.Timestamp(str(x)).is_leap_year)]
# 绘制图表
plt.figure(figsize(10, 6))
plt.bar(yearly_data.index, yearly_data.values, colorskyblue, labelAll Years)
plt.bar(leap_years.index, leap_years.values, colorgreen, labelLeap Years)
plt.xlabel(Year)
plt.ylabel(Total Value)
plt.title(Total Value per Year with Leap Years Highlighted)
plt.legend()
plt.show()
280-6-3、结果输出
# 280、pandas.Series.dt.is_leap_year属性
# 280-1、筛选闰年中的日期
# 闰年中的日期
# 730 2020-01-01
# 731 2020-01-02
# 732 2020-01-03
# 733 2020-01-04
# 734 2020-01-05
# ...
# 1091 2020-12-27
# 1092 2020-12-28
# 1093 2020-12-29
# 1094 2020-12-30
# 1095 2020-12-31
# Length: 366, dtype: datetime64[ns]# 280-2、标记闰年日期
# 标记闰年日期的数据前十行
# date value is_leap_year
# 0 2018-01-01 0 False
# 1 2018-01-02 1 False
# 2 2018-01-03 2 False
# 3 2018-01-04 3 False
# 4 2018-01-05 4 False
# 5 2018-01-06 5 False
# 6 2018-01-07 6 False
# 7 2018-01-08 7 False
# 8 2018-01-09 8 False
# 9 2018-01-10 9 False# 280-3、统计闰年和非闰年的数据
# 闰年数据总和: 333975
# 非闰年数据总和: 2065170# 280-4、可视化闰年和非闰年的数据
# 见图2图2 二、推荐阅读
1、Python筑基之旅
2、Python函数之旅
3、Python算法之旅
4、Python魔法之旅
5、博客个人主页