Python酷库之旅-第三方库Pandas(117)

目录

一、用法精讲

516、pandas.DataFrame.add_suffix方法

516-1、语法

516-2、参数

516-3、功能

516-4、返回值

516-5、说明

516-6、用法

516-6-1、数据准备

516-6-2、代码示例

516-6-3、结果输出

517、pandas.DataFrame.align方法

517-1、语法

517-2、参数

517-3、功能

517-4、返回值

517-5、说明

517-6、用法

517-6-1、数据准备

517-6-2、代码示例

517-6-3、结果输出

518、pandas.DataFrame.at_time方法

518-1、语法

518-2、参数

518-3、功能

518-4、返回值

518-5、说明

518-6、用法

518-6-1、数据准备

518-6-2、代码示例

518-6-3、结果输出

519、pandas.DataFrame.between_time方法

519-1、语法

519-2、参数

519-3、功能

519-4、返回值

519-5、说明

519-6、用法

519-6-1、数据准备

519-6-2、代码示例

519-6-3、结果输出

520、pandas.DataFrame.drop方法

520-1、语法

520-2、参数

520-3、功能

520-4、返回值

520-5、说明

520-6、用法

520-6-1、数据准备

520-6-2、代码示例

520-6-3、结果输出

二、推荐阅读

1、Python筑基之旅

2、Python函数之旅

3、Python算法之旅

4、Python魔法之旅

5、博客个人主页

一、用法精讲

516、pandas.DataFrame.add_suffix方法
516-1、语法
# 516、pandas.DataFrame.add_suffix方法
pandas.DataFrame.add_suffix(suffix, axis=None)
Suffix labels with string suffix.For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed.Parameters:
suffixstr
The string to add after each label.axis{0 or ‘index’, 1 or ‘columns’, None}, default None
Axis to add suffix onNew in version 2.0.0.Returns:
Series or DataFrame
New Series or DataFrame with updated labels.
516-2、参数

516-2-1、suffix(必须)字符串,要添加的后缀,表示你想要在列标签或行标签后添加的字符串。

516-2-2、axis(可选,默认值为None)表示你想在哪个轴上添加后缀,具体如下:

  • 默认值为None,表示对列标签添加后缀(相当于axis=1)。
  • axis=0:对行标签(索引)添加后缀。
  • axis=1:对列标签添加后缀
516-3、功能

        用于为DataFrame的行或列标签添加后缀。

516-4、返回值

        返回一个新的DataFrame,操作完后缀的标签和原来的数据内容保持一致,但标签已根据指定的后缀进行了修改。

516-5、说明

        无

516-6、用法
516-6-1、数据准备
516-6-2、代码示例
# 516、pandas.DataFrame.add_suffix方法
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3],'B': [4, 5, 6]
}, index=['x', 'y', 'z'])
print(df, '\n')
# 为列标签添加后缀
df_with_suffix = df.add_suffix('_col')
print(df_with_suffix, '\n')
# 为行标签添加后缀
df_with_suffix = df.add_suffix('_row', axis=0)
print(df_with_suffix)
516-6-3、结果输出
# 516、pandas.DataFrame.add_suffix方法
#    A  B
# x  1  4
# y  2  5
# z  3  6 
# 
#    A_col  B_col
# x      1      4
# y      2      5
# z      3      6 
# 
#        A  B
# x_row  1  4
# y_row  2  5
# z_row  3  6
517、pandas.DataFrame.align方法
517-1、语法
# 517、pandas.DataFrame.align方法
pandas.DataFrame.align(other, join='outer', axis=None, level=None, copy=None, fill_value=None, method=_NoDefault.no_default, limit=_NoDefault.no_default, fill_axis=_NoDefault.no_default, broadcast_axis=_NoDefault.no_default)
Align two objects on their axes with the specified join method.Join method is specified for each axis Index.Parameters:
otherDataFrame or Series
join{‘outer’, ‘inner’, ‘left’, ‘right’}, default ‘outer’
Type of alignment to be performed.left: use only keys from left frame, preserve key order.right: use only keys from right frame, preserve key order.outer: use union of keys from both frames, sort keys lexicographically.inner: use intersection of keys from both frames, preserve the order of the left keys.axisallowed axis of the other object, default None
Align on index (0), columns (1), or both (None).levelint or level name, default None
Broadcast across a level, matching Index values on the passed MultiIndex level.copybool, default True
Always returns new objects. If copy=False and no reindexing is required then original objects are returned.NoteThe copy keyword will change behavior in pandas 3.0. Copy-on-Write will be enabled by default, which means that all methods with a copy keyword will use a lazy copy mechanism to defer the copy and ignore the copy keyword. The copy keyword will be removed in a future version of pandas.You can already get the future behavior and improvements through enabling copy on write pd.options.mode.copy_on_write = Truefill_valuescalar, default np.nan
Value to use for missing values. Defaults to NaN, but can be any “compatible” value.method{‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}, default None
Method to use for filling holes in reindexed Series:pad / ffill: propagate last valid observation forward to next valid.backfill / bfill: use NEXT valid observation to fill gap.Deprecated since version 2.1.limitint, default None
If method is specified, this is the maximum number of consecutive NaN values to forward/backward fill. In other words, if there is a gap with more than this number of consecutive NaNs, it will only be partially filled. If method is not specified, this is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None.Deprecated since version 2.1.fill_axis{0 or ‘index’} for Series, {0 or ‘index’, 1 or ‘columns’} for DataFrame, default 0
Filling axis, method and limit.Deprecated since version 2.1.broadcast_axis{0 or ‘index’} for Series, {0 or ‘index’, 1 or ‘columns’} for DataFrame, default None
Broadcast values along this axis, if aligning two objects of different dimensions.Deprecated since version 2.1.Returns:
tuple of (Series/DataFrame, type of other)
Aligned objects.
517-2、参数

517-2-1、other(必须)DataFrame或Series,要与当前DataFrame对齐的另一个DataFrame或Series。

517-2-2、join(可选,默认值为'outer')字符串,指定对齐方式,可选值有:

  • 'outer':联合索引和列(并集)。
  • 'inner':交集索引和列。
  • 'left':使用调用DataFrame的索引和列。
  • 'right':使用other的索引和列。

517-2-3、axis(可选,默认值为None)整数或字符串,指定对齐的轴,可选值有:

  • None:对齐所有轴。
  • 0或'index':仅对齐行索引。
  • 1或'columns':仅对齐列标签。

517-2-4、level(可选,默认值为None)整数或级别名称,在层次化索引中指定对齐的层级。

517-2-5、copy(可选,默认值为None)布尔值,如果为True,则始终复制数据,即使索引和列标签已经对齐;如果为False,则尝试避免不必要的数据复制。

517-2-6、fill_value(可选,默认值为None)标量值,对缺失数据使用的填充值。

517-2-7、method(可选)字符串,填充的方法。可选值有:

  • 'ffill':向前填充。
  • 'bfill':向后填充

517-2-8、limit(可选)整数,向前或向后填充的最大次数。

517-2-9、fill_axis(可选)整数或字符串,指定填充值使用的轴,可选值有:

  • 0或'index':沿着行轴填充。
  • 1或'columns':沿着列轴填充。

517-2-10、broadcast_axis(可选)整数或字符串,未对齐维度的广播轴。

517-3、功能

        对两个DataFrame进行对齐操作,使它们的索引和列标签一致。

517-4、返回值

        返回一对齐的DataFrame,第一个是调用DataFrame对象,第二个是other对象,它们具有相同的索引和列标签。

517-5、说明

        无

517-6、用法
517-6-1、数据准备
517-6-2、代码示例
# 517、pandas.DataFrame.align方法
import pandas as pd
df1 = pd.DataFrame({'A': [1, 2, 3],'B': [4, 5, 6]
}, index=['x', 'y', 'z'])
df2 = pd.DataFrame({'B': [7, 8],'C': [9, 10]
}, index=['y', 'z'])
df1_aligned, df2_aligned = df1.align(df2, join='outer', fill_value=0)
print(df1_aligned)
print(df2_aligned)
517-6-3、结果输出
# 517、pandas.DataFrame.align方法
#    A  B  C
# x  1  4  0
# y  2  5  0
# z  3  6  0
#    A  B   C
# x  0  0   0
# y  0  7   9
# z  0  8  10
518、pandas.DataFrame.at_time方法
518-1、语法
# 518、pandas.DataFrame.at_time方法
pandas.DataFrame.at_time(time, asof=False, axis=None)
Select values at particular time of day (e.g., 9:30AM).Parameters:
time
datetime.time or str
The values to select.axis
{0 or ‘index’, 1 or ‘columns’}, default 0
For Series this parameter is unused and defaults to 0.Returns:
Series or DataFrame
Raises:
TypeError
If the index is not a DatetimeIndex
518-2、参数

518-2-1、time(必须)可以是字符串或时间对象,表示所需的时间(例如,'14:00')。

518-2-2、asof(可选,默认值为False)布尔值,如果设置为True,则返回的行将是时间上最接近但不晚于指定时间的行。

518-2-3、axis(可选,默认值为None)指定沿哪个轴进行选择(0表示行,1表示列)。

518-3、功能

        从带有时间索引的DataFrame中选择特定时间的行,它主要用于时间序列数据的分析和处理。

518-4、返回值

        返回一个新的DataFrame,其中只包含与指定时间匹配的行,如果asof参数设置为True,则返回的是时间上最接近但不晚于指定时间的行。

518-5、说明

        无

518-6、用法
518-6-1、数据准备
518-6-2、代码示例
# 518、pandas.DataFrame.at_time方法
import pandas as pd
data = {'value': [1, 2, 3, 4],
}
index = pd.date_range('2024-01-01 10:00', periods=4, freq='h')
df = pd.DataFrame(data, index=index)
result = df.at_time('11:00')
print(result)
518-6-3、结果输出
# 518、pandas.DataFrame.at_time方法
#                      value
# 2024-01-01 11:00:00      2
519、pandas.DataFrame.between_time方法
519-1、语法
# 519、pandas.DataFrame.between_time方法
pandas.DataFrame.between_time(start_time, end_time, inclusive='both', axis=None)
Select values between particular times of the day (e.g., 9:00-9:30 AM).By setting start_time to be later than end_time, you can get the times that are not between the two times.Parameters:
start_time
datetime.time or str
Initial time as a time filter limit.end_time
datetime.time or str
End time as a time filter limit.inclusive
{“both”, “neither”, “left”, “right”}, default “both”
Include boundaries; whether to set each bound as closed or open.axis
{0 or ‘index’, 1 or ‘columns’}, default 0
Determine range time on index or columns value. For Series this parameter is unused and defaults to 0.Returns:
Series or DataFrame
Data from the original object filtered to the specified dates range.Raises:
TypeError
If the index is not a DatetimeIndex.
519-2、参数

519-2-1、start_time(必须)字符串或时间对象,指定时间范围的起始时间,必须与DataFrame的时间索引一致。

519-2-2、end_time(必须)字符串或时间对象,指定时间范围的结束时间,必须与DataFrame的时间索引一致。

519-2-3、inclusive(可选,默认值为'both'){'both', 'neither', 'left', 'right'},可选的值有:

  • 'both':包含起始和结束时间的行。
  • 'neither':不包含起始和结束时间的行。
  • 'left':包含起始时间,但不包含结束时间的行。
  • 'right':不包含起始时间,但包含结束时间的行。

519-2-4、axis(可选,默认值为None){0或'index', 1或'columns'},该参数在DataFrame的操作中通常不使用,默认为None。

519-3、功能

        可以通过指定开始时间和结束时间,从DataFrame中筛选出符合时间条件的行,通过inclusive参数,可以控制是否包含起始和结束时间的行,以满足不同的需求。

519-4、返回值

        返回一个新的DataFrame,其中只包含在指定时间范围[start_time, end_time]内的行,如果没有任何符合条件的行,则返回一个空的DataFrame。

519-5、说明

        无

519-6、用法
519-6-1、数据准备
519-6-2、代码示例
# 519、pandas.DataFrame.between_time方法
import pandas as pd
data = {'value': [1, 2, 3, 4, 5],
}
index = pd.date_range('2024-01-01 08:00', periods=5, freq='h')
df = pd.DataFrame(data, index=index)
result = df.between_time('09:00', '11:00')
print(result)
519-6-3、结果输出
# 519、pandas.DataFrame.between_time方法
#                      value
# 2024-01-01 09:00:00      2
# 2024-01-01 10:00:00      3
# 2024-01-01 11:00:00      4
520、pandas.DataFrame.drop方法
520-1、语法
# 520、pandas.DataFrame.drop方法
pandas.DataFrame.drop(labels=None, *, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')
Drop specified labels from rows or columns.Remove rows or columns by specifying label names and corresponding axis, or by directly specifying index or column names. When using a multi-index, labels on different levels can be removed by specifying the level. See the user guide for more information about the now unused levels.Parameters:
labels
single label or list-like
Index or column labels to drop. A tuple will be used as a single label and not treated as a list-like.axis
{0 or ‘index’, 1 or ‘columns’}, default 0
Whether to drop labels from the index (0 or ‘index’) or columns (1 or ‘columns’).index
single label or list-like
Alternative to specifying axis (labels, axis=0 is equivalent to index=labels).columns
single label or list-like
Alternative to specifying axis (labels, axis=1 is equivalent to columns=labels).level
int or level name, optional
For MultiIndex, level from which the labels will be removed.inplace
bool, default False
If False, return a copy. Otherwise, do operation in place and return None.errors
{‘ignore’, ‘raise’}, default ‘raise’
If ‘ignore’, suppress error and only existing labels are dropped.Returns:
DataFrame or None
Returns DataFrame or None DataFrame with the specified index or column labels removed or None if inplace=True.Raises:
KeyError
If any of the labels is not found in the selected axis.
520-2、参数

520-2-1、labels(可选,默认值为None)单个标签或标签列表,指定要删除的行列的标签,该参数可以与index或columns一起使用,通常与axis配合使用。

520-2-2、axis(可选,默认值为0){0或'index', 1或'columns'}, 确定是删除行(0 或 'index')还是列(1 或 'columns'),如果labels被指定,则axis可被省略。

520-2-3、index(可选,默认值为None)单个标签或标签列表,指要删除的行的标签,该参数与labels参数互斥的。

520-2-4、columns(可选,默认值为None)单个标签或标签列表,指要删除的列的标签,该参数与labels参数互斥的。

520-2-5、level(可选,默认值为None)整数或级别名称,在多层索引情况下,指定要删除的级别。

520-2-6、inplace(可选,默认值为False)布尔值,如果设置为True,将直接在原DataFrame上执行删除操作,而不返回新的DataFrame。

520-2-7、errors(可选,默认值为'raise'){'raise', 'ignore'},指定如何处理错误,如果设置为'raise',在删除不存在的标签时会引发错误;如果设置为'ignore',则会忽略这些错误。

520-3、功能

        用于删除指定的行或列这个方法提供了活的参数设置,允许用户根据需要选择删除的对象。

520-4、返回值

        返回一个新的DataFrame,其中删除了指定的行或列,如果inplace=True,则返回值为None,原DataFrame 将被修改。

520-5、说明

        无

520-6、用法
520-6-1、数据准备
520-6-2、代码示例
# 520、pandas.DataFrame.drop方法
import pandas as pd
# 创建一个示例 DataFrame
data = {'Name': ['Myelsa', 'Bryce', 'Jimmy', 'Lucy'],'Age': [43, 6, 15, 43],'City': ['New York', 'Los Angeles', 'Chicago', 'San Francisco']
}
df = pd.DataFrame(data)
print("原始DataFrame:")
print(df)
# 删除一行(例如,删除 Bob 的数据)
df_dropped_row = df.drop(labels=1)  # 1 是 Bob 的索引
print("\n删除一行后的DataFrame:")
print(df_dropped_row)
# 删除一列(例如,删除 Age 列)
df_dropped_column = df.drop(columns='Age')
print("\n删除一列后的DataFrame:")
print(df_dropped_column)
# 在原 DataFrame 上删除,删除 Charlie 的数据
df.drop(labels=2, inplace=True)  # 2 是 Charlie 的索引
print("\n在原DataFrame上删除一行后的结果:")
print(df)
# 尝试删除不存在的标签,并使用 errors='ignore' 防止引发错误
df_dropped_nonexistent = df.drop(labels=10, errors='ignore')  # 假设 10 不存在
print("\n尝试删除不存在的行后的DataFrame:")
print(df_dropped_nonexistent)
520-6-3、结果输出
# 520、pandas.DataFrame.drop方法
# 原始DataFrame:
#      Name  Age           City
# 0  Myelsa   43       New York
# 1   Bryce    6    Los Angeles
# 2   Jimmy   15        Chicago
# 3    Lucy   43  San Francisco
# 
# 删除一行后的DataFrame:
#      Name  Age           City
# 0  Myelsa   43       New York
# 2   Jimmy   15        Chicago
# 3    Lucy   43  San Francisco
# 
# 删除一列后的DataFrame:
#      Name           City
# 0  Myelsa       New York
# 1   Bryce    Los Angeles
# 2   Jimmy        Chicago
# 3    Lucy  San Francisco
# 
# 在原DataFrame上删除一行后的结果:
#      Name  Age           City
# 0  Myelsa   43       New York
# 1   Bryce    6    Los Angeles
# 3    Lucy   43  San Francisco
# 
# 尝试删除不存在的行后的DataFrame:
#      Name  Age           City
# 0  Myelsa   43       New York
# 1   Bryce    6    Los Angeles
# 3    Lucy   43  San Francisco

二、推荐阅读

1、Python筑基之旅
2、Python函数之旅
3、Python算法之旅
4、Python魔法之旅
5、博客个人主页

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/879526.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

12. DataLoader的基本使用

DataLoader的基本使用 1. 为什么要使用DataLoader DataLoader对创建好的DataSet的样本取样进行了集成操作,非常方便对于后续网络训练、测试的数据集的选择和使用 DataLoader可以集成了数据批量加载的方法,可以使用 batch_size 设置批量大小,DataLoader就会自动处理批量数据…

adb install失败: INSTALL_PARSE_FAILED_NO_CERTIFICATES

这个错误表明在尝试安装 APK 文件时出现了问题,原因是 APK 文件中的 AndroidManifest.xml 没有签名证书。在 Android 系统中,所有的应用都必须经过签名才能安装到设备上。以下是解决此问题的方法: 方法一:使用 Android Studio 或命…

Go语言基本语法

Go语言(通常称为Golang)是由Google开发的一种静态类型、编译型语言,它旨在简化系统编程、网络编程和并发编程的复杂性。 Go语言以其简洁、高效和易于理解的语法而受到开发者的喜爱。 Go语言的一些基本语法元素: 1. 包&#xff…

protobuf中c、c++、python使用

文章目录 protobuf实例:例题1:[CISCN 2023 初赛]StrangeTalkBot分析:思路:利用: 例题2:[CISCN 2024]protoverflow分析: protobuf Protocol Buffers,是Google公司开发的一种数据描述语…

python提取pdf表格到excel:拆分、提取、合并

本文介绍使用python提取pdf中的表格到excel中,包含pdf的拆分、pdf提取到excel、合并excel。 一、拆分pdf 将一个大的pdf按页数拆分为多个小的pdf: # pip install PyPDF2import os, pdfplumber, PyPDF2# 分割pdf def split_pdf(input_pdf_path, num_splits):# Create a PDF…

数学学习记录

9月14日 1.映射: 2.函数: 9月15日 3.反函数: 4.收敛数列的性质 5.反三角函数: 9月16日 6.函数的极限: 7.无穷小和无穷大 极限运算法则:

MySQL里面的日期字符串如何转成日期做比较运算,获取两个日期之间的所有日期(包括起始日期)

SELECTSUM( current_in_amt ) AS total_in_amt FROMt_ads_spare_store_in_contrast WHERESTR_TO_DATE( etl_date, %Y-%m-%d ) > STR_TO_DATE( 2024-01-01, %Y-%m-%d ) AND STR_TO_DATE( etl_date, %Y-%m-%d ) < STR_TO_DATE( 2024-01-04, %Y-%m-%d ); 比如日期格式是 …

远程Linux网络连接( Linux 网络操作系统 04)

接下来我们准备开始进入Linux操作系统的第二个模块的学习&#xff0c;不过在学习之前我们需要对如下进行简单的配置&#xff0c;通过外接辅助软件MobaXterm来进行虚拟操作系统的访问。接下来的课程我们会一直在MobaXterm中进行命令和相关知识的学习。 一、准备阶段 1.1 软件 …

第R3周:LSTM-火灾温度预测:3. nn.LSTM() 函数详解

nn.LSTM 是 PyTorch 中用于创建长短期记忆&#xff08;Long Short-Term Memory&#xff0c;LSTM&#xff09;模型的类。LSTM 是一种循环神经网络&#xff08;Recurrent Neural Network&#xff0c;RNN&#xff09;的变体&#xff0c;用于处理序列数据&#xff0c;能够有效地捕捉…

骑砍2霸主MOD开发(26)-使用TrfExporterBlender制作TRF文件

一.Blender导入TRF文件 import bpytrf_meshes = []trf_contents = []trf_import_path = D:\pt_ladder.trftrf_export_path = D:\pt_ladder_morph_keys.trfclass TrfMesh:def __init__(self):self.mesh_name = self.mesh_materials = []self.vertex_cnt = 0self.vertex_fvf_cnt…

2848. 与车相交的点(24.9.19)

祝各位中秋节快乐&#xff01; 题目 问题描述&#xff1a; 给你一个下标从 0 开始的二维整数数组 nums 表示汽车停放在数轴上的坐标。对于任意下标 i&#xff0c;nums [i] [start_i, end_i]&#xff1a;其中 start_i 是第 i 辆车的起点&#xff0c;end_i 是第 i 辆车的终点。…

学习笔记JVM篇(三)

一、垃圾回收机制 垃圾回收&#xff08;Garbage Collection&#xff09;机制&#xff0c;是自动回收无用对象从而释放内存的一种机制。Java之所以相对简单&#xff0c;很大程度是归功于垃圾回收机制。&#xff08;例如C语言申请内存后要手动的释放&#xff09; 优点&#xff…

数据清洗-缺失值填充-K-NN算法(K-Nearest Neighbors, K-NN算法)

目录 一、安装所需的python包二、采用K-NN算法进行缺失值填充2.1可直接运行代码2.2以某个缺失值数据进行实战2.2.1代码运行过程截屏&#xff1a;2.2.2填充后的数据截屏&#xff1a; 三、K 近邻算法 (K-Nearest Neighbors, KNN) 介绍3.1 K 近邻算法定义3.2 K 近邻算法的基本思想…

福建科立讯通信 指挥调度管理平台 SQL注入漏洞

北峰通信-福建科立讯通信 指挥调度管理平台 SQL注入漏洞 厂商域名和信息收集 域名&#xff1a; 工具sqlmap python sqlmap.py -u "http://ip:端口/api/client/down_file.php?uuid1" --batch 数据包 GET /api/client/down_file.php?uuid1%27%20AND%20(SELECT%20…

替换 Oracle ,江河信息用 TDengine 解决高基数查询写入问题

在数字经济快速发展的背景下&#xff0c;智慧水利作为重要的基础设施之一&#xff0c;正逐步成为提升水资源管理效率、优化生态环境的重要力量。江西省水投江河信息技术有限公司&#xff08;以下简称“江河信息”&#xff09;作为高新技术国有企业&#xff0c;坚定致力于打造数…

Leetcode 每日一题:Longest Increasing Path in a Matrix

写在前面&#xff1a; 今天我们继续看一道 图论和遍历 相关的题目。这道题目的背景是在一个矩阵当中找寻最长的递增数列长度。思路上非常好想&#xff0c;绝对和 DFS 相关&#xff0c;但是题目的优化要求非常高&#xff0c;对于语言和内存特性的考察特别丰富&#xff0c;如果是…

15. Springboot集成Redis

目录 1、前言 2、为什么选择Spring Boot集成Redis&#xff1f; 3、快速上手 3.1、引入依赖 3.2、 配置连接信息 3.3、自定义配置类 4、RedisTemplate的使用 4.1、String类型操作 4.2、 Hash类型操作 4.3、List类型操作 4.4、Set类型操作 4.5、SortedSet类型操作 4…

第十一章 【后端】商品分类管理微服务(11.2)——Lombok

11.2 Lombok 官网:https://projectlombok.org/ 较新版本的 idea 已默认安装 lombok 插件 Lombok 工具提供一系列的注解,使用这些注解可以不用定义 getter、setter、equals、constructor 等,可以消除 java 代码的臃肿,编译时它会在字节码文件中自动生成这些通用的方法,简…

ElK 8 收集 Nginx 日志

1. 说明 elk 版本&#xff1a;8.15.0 2. 启个 nginx 有 nginx 可以直接使用。我这里是在之前环境下 docker-compose.yml 中启动了个 nginx&#xff1a; nginx:restart: alwaysimage: nginx:1.26.1ports:- "80:80"- "443:443"volumes:#- ./nginx/html:/…

【题解】—— LeetCode一周小结37

&#x1f31f;欢迎来到 我的博客 —— 探索技术的无限可能&#xff01; &#x1f31f;博客的简介&#xff08;文章目录&#xff09; 【题解】—— 每日一道题目栏 上接&#xff1a;【题解】—— LeetCode一周小结36 9.合并零之间的节点 题目链接&#xff1a;2181. 合并零之间…