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

news2024/9/17 9:11:06

目录

一、用法精讲

171、pandas.Series.nlargest方法

171-1、语法

171-2、参数

171-3、功能

171-4、返回值

171-5、说明

171-6、用法

171-6-1、数据准备

171-6-2、代码示例

171-6-3、结果输出

172、pandas.Series.nsmallest方法

172-1、语法

172-2、参数

172-3、功能

172-4、返回值

172-5、说明

172-6、用法

172-6-1、数据准备

172-6-2、代码示例

172-6-3、结果输出

173、pandas.Series.pct_change方法

173-1、语法

173-2、参数

173-3、功能

173-4、返回值

173-5、说明

173-6、用法

173-6-1、数据准备

173-6-2、代码示例

173-6-3、结果输出

174、pandas.Series.prod方法

174-1、语法

174-2、参数 

174-3、功能

174-4、返回值

174-5、说明

174-6、用法

174-6-1、数据准备

174-6-2、代码示例

174-6-3、结果输出

175、pandas.Series.quantile方法

175-1、语法

175-2、参数

175-3、功能

175-4、返回值

175-5、说明

175-6、用法

175-6-1、数据准备

175-6-2、代码示例

175-6-3、结果输出

二、推荐阅读

1、Python筑基之旅

2、Python函数之旅

3、Python算法之旅

4、Python魔法之旅

5、博客个人主页

一、用法精讲

171、pandas.Series.nlargest方法
171-1、语法
# 171、pandas.Series.nlargest方法
pandas.Series.nlargest(n=5, keep='first')
Return the largest n elements.

Parameters:
n
int, default 5
Return this many descending sorted values.

keep
{‘first’, ‘last’, ‘all’}, default ‘first’
When there are duplicate values that cannot all fit in a Series of n elements:

first : return the first n occurrences in order of appearance.

last : return the last n occurrences in reverse order of appearance.

all : keep all occurrences. This can result in a Series of size larger than n.

Returns:
Series
The n largest values in the Series, sorted in decreasing order.
171-2、参数

171-2-1、n(可选,默认值为5)一个整数,选择的最大的元素的数量。

171-2-2、keep(可选,默认值为'first'){'first', 'last', 'all'},当出现多个相同大小的值时,如何处理:

  • 'first': 保留最早出现的n个。
  • 'last': 保留最后出现的n个。
  • 'all': 保留所有最大值,不考虑n。
171-3、功能

171-3-1、选择最大值:从Series中选择前n个最大的值。

171-3-2、排序:返回的结果是按值从大到小排序的。

171-3-3、处理重复值:可以通过keep参数控制如何处理重复值。

171-4、返回值

171-4-1、返回类型:pandas.Series。

171-4-2、内容:包含前n个最大的值,按降序排列。

171-5、说明

171-5-1、性能:nlargest方法会对数据进行排序,在处理大型数据集时可能会较慢。

171-5-2、重复值处理:可以通过keep参数来控制是否保留第一个出现的、最后一个出现的或者所有重复的最大值。

171-6、用法
171-6-1、数据准备
171-6-2、代码示例
# 171、pandas.Series.nlargest方法
# 171-1、数据探索与分析
import pandas as pd
# 示例:学生成绩数据
scores = pd.Series([85, 90, 78, 92, 88, 76, 95, 89])
# 获取前3个最高的成绩
top_scores = scores.nlargest(n=3)
print(top_scores, end='\n\n')

# 171-2、异常检测
import pandas as pd
# 示例:传感器读数数据
sensor_data = pd.Series([100, 150, 200, 250, 300, 350, 400, 450, 500, 1000])
# 获取前2个最大的读数
top_readings = sensor_data.nlargest(n=2)
print(top_readings, end='\n\n')

# 171-3、绩效评估
import pandas as pd
# 示例:销售数据
sales = pd.Series([12000, 15000, 18000, 20000, 22000, 25000, 27000, 30000])
# 获取销售额前3名的销售代表
top_sales = sales.nlargest(n=3)
print(top_sales, end='\n\n')

# 171-4、资源分配
import pandas as pd
# 示例:客户投诉数据
complaints = pd.Series([5, 15, 25, 35, 45, 55, 65, 75, 85, 95])
# 获取前3个最严重的投诉
top_complaints = complaints.nlargest(n=3)
print(top_complaints, end='\n\n')

# 171-5、投资决策
import pandas as pd
# 示例:股票收益数据
returns = pd.Series([0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50])
# 获取收益前3名的股票
top_returns = returns.nlargest(n=3)
print(top_returns)
171-6-3、结果输出
# 171、pandas.Series.nlargest方法
# 171-1、数据探索与分析
# 6    95
# 3    92
# 1    90
# dtype: int64

# 171-2、异常检测
# 9    1000
# 8     500
# dtype: int64

# 171-3、绩效评估
# 7    30000
# 6    27000
# 5    25000
# dtype: int64

# 171-4、资源分配
# 9    95
# 8    85
# 7    75
# dtype: int64

# 171-5、投资决策
# 9    0.50
# 8    0.45
# 7    0.40
# dtype: float64
172、pandas.Series.nsmallest方法
172-1、语法
# 172、pandas.Series.nsmallest方法
pandas.Series.nsmallest(n=5, keep='first')
Return the smallest n elements.

Parameters:
n
int, default 5
Return this many ascending sorted values.

keep
{‘first’, ‘last’, ‘all’}, default ‘first’
When there are duplicate values that cannot all fit in a Series of n elements:

first : return the first n occurrences in order of appearance.

last : return the last n occurrences in reverse order of appearance.

all : keep all occurrences. This can result in a Series of size larger than n.

Returns:
Series
The n smallest values in the Series, sorted in increasing order.
172-2、参数

172-2-1、n(可选,默认值为5)指定要返回的最小值的数量,如果n大于Series的长度,则返回整个Series。

172-2-2、keep(可选,默认值为'first'){'first', 'last', 'all'},当出现多个相同大小的值时,如何处理:

  • 'first': 保留最早出现的n个。
  • 'last': 保留最后出现的n个。
  • 'all': 保留所有最小值,不考虑n。
172-3、功能

172-3-1、提取最小值:从Series中提取指定数量的最小值。

172-3​​​​​​​-2、处理重复值:可以通过keep参数指定如何处理重复值。

172-4、返回值

        返回一个包含指定数量最小值的新的Series,返回的Series保留了原始Series的索引信息,这样可以方便地追踪这些最小值在原始数据中的位置。

172-5、说明

        无

172-6、用法
172-6-1、数据准备
172-6-2、代码示例
# 172、pandas.Series.nsmallest方法
# 172-1、默认用法
import pandas as pd
data = pd.Series([3, 5, 6, 8, 10, 10, 11, 24])
result = data.nsmallest()
print(result, end='\n\n')

# 172-2、指定n参数
import pandas as pd
data = pd.Series([3, 5, 6, 8, 10, 10, 11, 24])
result = data.nsmallest(n=3)
print(result, end='\n\n')

# 172-3、使用keep='last'
import pandas as pd
data = pd.Series([3, 5, 6, 8, 10, 10, 11, 24])
result = data.nsmallest(n=5, keep='last')
print(result, end='\n\n')

# 172-4、使用keep='all'
import pandas as pd
data = pd.Series([3, 5, 6, 8, 10, 10, 11, 24])
result = data.nsmallest(n=5, keep='all')
print(result)
172-6-3、结果输出
# 172、pandas.Series.nsmallest方法
# 172-1、默认用法
# 0     3
# 1     5
# 2     6
# 3     8
# 4    10
# dtype: int64

# 172-2、指定n参数
# 0    3
# 1    5
# 2    6
# dtype: int64

# 172-3、使用keep='last'
# 0     3
# 1     5
# 2     6
# 3     8
# 5    10
# dtype: int64

# 172-4、使用keep='all'
# 0     3
# 1     5
# 2     6
# 3     8
# 4    10
# 5    10
# dtype: int64
173、pandas.Series.pct_change方法
173-1、语法
# 173、pandas.Series.pct_change方法
pandas.Series.pct_change(periods=1, fill_method=_NoDefault.no_default, limit=_NoDefault.no_default, freq=None, **kwargs)
Fractional change between the current and a prior element.

Computes the fractional change from the immediately previous row by default. This is useful in comparing the fraction of change in a time series of elements.

Note

Despite the name of this method, it calculates fractional change (also known as per unit change or relative change) and not percentage change. If you need the percentage change, multiply these values by 100.

Parameters:
periodsint, default 1
Periods to shift for forming percent change.

fill_method{‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}, default ‘pad’
How to handle NAs before computing percent changes.

Deprecated since version 2.1: All options of fill_method are deprecated except fill_method=None.

limitint, default None
The number of consecutive NAs to fill before stopping.

Deprecated since version 2.1.

freqDateOffset, timedelta, or str, optional
Increment to use from time series API (e.g. ‘ME’ or BDay()).

**kwargs
Additional keyword arguments are passed into DataFrame.shift or Series.shift.

Returns:
Series or DataFrame
The same type as the calling object.
173-2、参数

173-2-1、periods(可选,默认值为1)整数,表示计算变化的间隔期数。例如,periods=1表示当前元素与前一个元素的变化,periods=2表示当前元素与前两个元素的变化。

173-2-2、fill_method(可选){'backfill', 'bfill', 'pad', 'ffill', None},用于填充缺失值的方法:

173-2-2-1、'backfill'或'bfill': 使用之后的有效值填充NaN。

173-2-2-2、'pad'或'ffill': 使用之前的有效值填充NaN。

173-2-3、limit(可选)整数,最多填充多少个连续的NaN值。

173-2-4、freq(可选,默认值为None)用于时间序列的频率转换。例如,freq='M'表示按月计算变化。

173-2-5、**kwargs(可选)其他传递给内部填充方法的关键字参数。

173-3、功能

        用于计算当前元素与前一个元素之间的百分比变化,该方法在时间序列分析中非常有用,因为它可以帮助我们快速识别变化趋势和波动。

173-4、返回值

        返回一个包含百分比变化的Series,如果当前元素或前一个元素为NaN,则相应的百分比变化也会是NaN。

173-5、说明

        无

173-6、用法
173-6-1、数据准备
173-6-2、代码示例
# 173、pandas.Series.pct_change方法
# 173-1、默认用法
import pandas as pd
data = pd.Series([100, 120, 130, 90, 160])
result = data.pct_change()
print(result, end='\n\n')

# 173-2、指定periods参数
import pandas as pd
data = pd.Series([100, 120, 130, 90, 160])
result = data.pct_change(periods=2)
print(result, end='\n\n')

# 173-3、使用fill_method填充缺失值
import pandas as pd
data_with_nan = pd.Series([100, None, 130, 90, 160])
result = data_with_nan.pct_change(fill_method='ffill')
print(result, end='\n\n')

# 173-4、指定limit和fill_method参数
import pandas as pd
data_with_nan = pd.Series([100, None, 130, 90, 160])
result = data_with_nan.pct_change(fill_method='ffill', limit=1)
print(result)
173-6-3、结果输出
# 173、pandas.Series.pct_change方法
# 173-1、默认用法
# 0         NaN
# 1    0.200000
# 2    0.083333
# 3   -0.307692
# 4    0.777778
# dtype: float64

# 173-2、指定periods参数
# 0         NaN
# 1         NaN
# 2    0.300000
# 3   -0.250000
# 4    0.230769
# dtype: float64

# 173-3、使用fill_method填充缺失值
# 0         NaN
# 1    0.000000
# 2    0.300000
# 3   -0.307692
# 4    0.777778
# dtype: float64

# 173-4、指定limit和fill_method参数
# 0         NaN
# 1    0.000000
# 2    0.300000
# 3   -0.307692
# 4    0.777778
# dtype: float64
174、pandas.Series.prod方法
174-1、语法
# 174、pandas.Series.prod方法
pandas.Series.prod(axis=None, skipna=True, numeric_only=False, min_count=0, **kwargs)
Return the product of the values over the requested axis.

Parameters:
axis{index (0)}
Axis for the function to be applied on. For Series this parameter is unused and defaults to 0.

Warning

The behavior of DataFrame.prod with axis=None is deprecated, in a future version this will reduce over both axes and return a scalar To retain the old behavior, pass axis=0 (or do not pass axis).

New in version 2.0.0.

skipnabool, default True
Exclude NA/null values when computing the result.

numeric_onlybool, default False
Include only float, int, boolean columns. Not implemented for Series.

min_countint, default 0
The required number of valid values to perform the operation. If fewer than min_count non-NA values are present the result will be NA.

**kwargs
Additional keyword arguments to be passed to the function.

Returns:
scalar or scalar
174-2、参数 

174-2-1、axis(可选,默认值为None)只适用于DataFrame,对于Series来说,该参数无效。

174-2-2、skipna(可选,默认值为True)指定是否跳过NaN值,如果设置为True(默认情况),NaN值将被忽略,计算时只考虑非空值;如果设置为False,结果将是NaN,如果存在NaN值。

174-2-3、numeric_only(可选,默认值为False)指定是否仅考虑数值类型的数据,如果为True,则仅包含数字类型数据进行计算;对于Series来说,该参数通常无效,因为Series本身通常只有一种数据类型。

174-2-4、min_count(可选,默认值为0)表示需要参与计算的最小有效值数量,如果非零有效值的数量小于min_count,则结果为NaN。例如,如果设置min_count=1,而Series中没有非零值,则返回NaN

174-2-5、**kwargs(可选)其他关键字参数,以后可能用于扩展方法的功能。

174-3、功能

        用于计算Series元素的乘积,并返回一个浮点数或整数,表示所有非NaN元素的乘积。

174-4、返回值

174-4-1、数值类型: 返回值为浮点数或整数,具体取决于Series的数据类型和参与计算的元素。

174-4​​​​​​​-2、缺失值情况: 如果skipna=FalseSeries中存在NaN值,返回NaN,如果有效值数量少于min_count,返回NaN

174-5、说明

        无

174-6、用法
174-6-1、数据准备
174-6-2、代码示例
# 174、pandas.Series.prod方法
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 4])
# 计算所有非NaN元素的乘积
result = s.prod()
print(result)

# 不跳过NaN值
result_skipna_false = s.prod(skipna=False)
print(result_skipna_false)

# 需要至少2个有效值参与计算,否则返回NaN
result_min_count = s.prod(min_count=2)
print(result_min_count)

# 需要至少5个有效值参与计算
result_min_count_high = s.prod(min_count=5)
print(result_min_count_high)
174-6-3、结果输出
# 174、pandas.Series.prod方法
# 24.0
# nan
# 24.0
# nan
175、pandas.Series.quantile方法
175-1、语法
# 175、pandas.Series.quantile方法
pandas.Series.quantile(q=0.5, interpolation='linear')
Return value at the given quantile.

Parameters:
qfloat or array-like, default 0.5 (50% quantile)
The quantile(s) to compute, which can lie in range: 0 <= q <= 1.

interpolation{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}
This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points i and j:

linear: i + (j - i) * (x-i)/(j-i), where (x-i)/(j-i) is the fractional part of the index surrounded by i > j.

lower: i.

higher: j.

nearest: i or j whichever is nearest.

midpoint: (i + j) / 2.

Returns:
float or Series
If q is an array, a Series will be returned where the index is q and the values are the quantiles, otherwise a float will be returned.
175-2、参数

175-2-1、q(可选,默认值为0.5)表示分位数值,取值范围为[0, 1]之间的浮点数。例如,0.5表示中位数。

175-2-2、interpolation(可选,默认值为'linear')表示指定插值方法,其他选项包括'lower'、'higher'、'nearest'和'midpoint'。

175-3、功能

175-3-1、计算分位数: 根据参数q的值,计算指定分位数。

175-3​​​​​​​-2、插值方式: 通过interpolation参数指定计算分位数时使用的插值方法。

175-4、返回值

175-4-1、数值类型: 返回指定分位数的值。

175-4​​​​​​​-2、数据类型一致: 返回值的类型与Series中的数据类型一致。

175-5、说明

        无

175-6、用法
175-6-1、数据准备
175-6-2、代码示例
# 175、pandas.Series.quantile方法
# 175-1、计算中位数(0.5分位数)
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 5])
median = s.quantile(q=0.5)
print(median, end='\n\n')

# 175-2、使用'lower'插值方法计算0.5分位数
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 5])
median_lower = s.quantile(q=0.5, interpolation='lower')
print(median_lower, end='\n\n')

# 175-3、使用'higher'插值方法计算0.5分位数
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 5])
median_higher = s.quantile(q=0.5, interpolation='higher')
print(median_higher, end='\n\n')

# 175-4、计算0.25分位数
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 5])
first_quartile = s.quantile(q=0.25)
print(first_quartile, end='\n\n')

# 175-5、计算0.75分位数
import pandas as pd
import numpy as np
# 创建一个Series
s = pd.Series([1, 2, 3, np.nan, 5])
third_quartile = s.quantile(q=0.75)
print(third_quartile)
175-6-3、结果输出
# 175、pandas.Series.quantile方法
# 175-1、计算中位数(0.5分位数)
# 2.5

# 175-2、使用'lower'插值方法计算0.5分位数
# 2.0

# 175-3、使用'higher'插值方法计算0.5分位数
# 3.0

# 175-4、计算0.25分位数
# 1.75

# 175-5、计算0.75分位数
# 3.5

二、推荐阅读

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

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

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

相关文章

刷新历史新高后又大跌!剖析黄金现在适合投资吗?

近期现货黄金价格的波动再度受到世界投资者的瞩目&#xff0c;先是七月上旬受美国CPI数据走弱、美联储降息预期增强等因素的影响&#xff0c;金价出现了十分强势的上涨&#xff0c;而且刷新历史高点2482。但从七月下旬开始&#xff0c;市场开始消化降息的预期&#xff0c;并且部…

Kimi与AiPPT合作:一键生成PPT的新体验

Kimi AiPPT 又是一次强强联手&#xff01;这次 Kimi 与 AiPPT 达成协作&#xff0c;作为国内领先的智能助手和宏大的PPT制作平台&#xff0c;两者携手推出的一键生成PPT功能。这次合作直接合并了双方各自的优势&#xff0c;通过“一键生成PPT”的创新服务&#xff0c;极大地提…

昇思25天学习打卡营第20天|ShuffleNet 图像分类案例:模块、训练与评估

目录 基于 MindSpore 的分组卷积类定义与实现 基于 MindSpore 的 ShuffleV1Block 类定义与数据处理 基于 MindSpore 的 ShuffleNetV1 网络定义与构建 Cifar-10 数据集的获取、预处理与分批操作 基于 ShuffleNetV1 模型在 CPU 上的训练配置与执行 ShuffleNetV1 模型在 CPU …

【神器分享】自从用了这个神器,大规模RNA-seq数据挖掘我也可以

咱不来虚的&#xff0c;只分享干货&#xff0c;不谈枯燥的理论&#xff0c;只来通俗易懂的操作。先来看一张图&#xff1a; 通过这张图展示的是 GEO数据库中的 RNA-seq数据与芯片数据积累随时间的变化&#xff0c;很显然测序数据从2015年开始就已经超过了芯片数据的累积 &#…

EtherCAT运动控制器上位机之Python+Qt(一):链接与单轴运动

ZMC408CE硬件介绍 ZMC408CE是正运动推出的一款多轴高性能EtherCAT总线运动控制器&#xff0c;具有EtherCAT、EtherNET、RS232、CAN和U盘等通讯接口&#xff0c;ZMC系列运动控制器可应用于各种需要脱机或联机运行的场合。 ZMC408CE支持8轴运动控制&#xff0c;最多可扩展至32轴…

AI初学者必看: 什么是大型语言模型 (LLM)?

介绍 “人工智能&#xff08;AI&#xff09;”一词于 1956 年问世&#xff0c;如今已为大家所熟知。然而&#xff0c;在 ChatGPT 迅速流行之前&#xff0c;AI 的使用和讨论大多局限于科学研究或虚构电影。如今&#xff0c;AI 尤其是生成式 AI 已成为大家热议的话题。 初学者生…

使用Process Explorer和Dependency Walker排查dll动态库加载失败的问题

目录 1、问题描述 2、如何调试Release版本的代码&#xff1f; 3、使用Process Explorer查看exe主程序加载的dll库列表&#xff0c;发现mediaplay.dll没有加载起来 4、使用Dependency Walker查看rtcmpdll.dll的库依赖关系和接口调用情况&#xff0c;定位问题 4.1、使用Depe…

html+css+js 实现3D透视倾斜按钮,javascript库之vanilla-tilt.js详解

前言&#xff1a;哈喽&#xff0c;大家好&#xff0c;今天给大家分享htmlcss 绚丽效果&#xff01;并提供具体代码帮助大家深入理解&#xff0c;彻底掌握&#xff01;创作不易&#xff0c;如果能帮助到大家或者给大家一些灵感和启发&#xff0c;欢迎收藏关注哦 &#x1f495; 文…

常用游戏运行库 v4 官方版下载与安装教程 (游戏DLL补全包)

前言 游戏运行库包含了VC运行库合集&#xff0c;.NET2.0到.NET4.8合集&#xff0c;DirectX9.0 Rapture3D 等游戏必备的系统组件&#xff0c;如果你的游戏安装后无法运行&#xff0c;那么安装这些组件基本上就可以解决。本必备运行库安装包集成32位和64位运行库&#xff0c;是目…

(自用)MyLog 简单日志 .net6.0 等

appsettings.json {"LogOnOff": true //true 开启日志&#xff1b;false 关闭日志 } MyLog.cs using System.ComponentModel;namespace Namespace {/// <summary>/// 日志类型 枚举/// </summary>public enum LogType{[Description("调试日志&q…

Android经典面试题之实战经验分享:如何简单实现App的前后台监听判断

本文首发于公众号“AntDream”&#xff0c;欢迎微信搜索“AntDream”或扫描文章底部二维码关注&#xff0c;和我一起每天进步一点点 在Android中判断一个应用是否处于前台或后台&#xff0c;可以使用ActivityLifecycleCallbacks 和 ProcessLifecycleOwner。在Kotlin中&#xff…

实验2-5-3 求平方根序列前N项和

//实验2-5-3 求平方根序列前N项和/*本题要求编写程序&#xff0c; 计算平方根序列123⋯的前N项之和。 可包含头文件math.h&#xff0c;并调用sqrt函数求平方根。*/#include<stdio.h> #include<math.h> int main(){int n0;scanf("%d",&n);//输入Nint …

【Canvas与艺术】三环莫比乌斯圈

【成图】 【代码】 <!DOCTYPE html> <html lang"utf-8"> <meta http-equiv"Content-Type" content"text/html; charsetutf-8"/> <head><title>三环莫比乌斯圈</title><style type"text/css"&g…

测桃花运(算姻缘)的网站系统源码

简介&#xff1a; 站长安装本源码后只要有人在线测算&#xff0c;就可以获得收入哦。是目前市面上最火的变现利器。 本版本无后台&#xff0c;无数据。本版本为开发的逗号联盟接口版本。直接对接逗号联盟&#xff0c;修改ID就可以直接运营收费赚钱。 安装环境&#xff1a;PH…

可以个性化的网盘与相册服务 PDS

可以个性化的网盘与相册服务 PDS 什么是PDS企业版企业网盘团队管理用户管理安全策略企业设置文件设置及其他设置专属登录配置 使用建议企业网盘用户端开发者版体验感受 什么是PDS 在正式开始测评PDS之前&#xff0c;首先来了解一下什么是PDS。PDS 网盘与相册服务&#xff08;D…

Pythonic 的从远程列表中提取分支名称方法

1、问题背景 在 Git 版本控制系统中&#xff0c;我们需要经常使用 git ls-remote 命令来获取远程仓库的分支列表。 这个命令的输出通常包含分支的哈希值和分支名称&#xff0c;就像这样&#xff1a; db6ad7246abf74cb845baa60e6fe45dacf897612 HEAD 1fc347b17201054d8b5b9…

YOLOv8 基于BN层的通道剪枝

YOLOv8 基于BN层的通道剪枝 1. 稀疏约束训练 在损失项中增加对BN层的缩放系数 γ \gamma γ和偏置项 β \beta β的稀疏约束&#xff0c; λ \lambda λ系数越大&#xff0c;稀疏约束越严重 L ∑ ( x , y ) l ( f ( x ) , y ) λ 1 ∑ γ g ( γ ) λ 2 ∑ β g ( β ) L…

华杉研发九学习日记18 集合 泛型

华杉研发九学习日记18 一&#xff0c;集合框架 1.1 集合和数组的区别 集合就是在java中用来保存多个对象的容器 集合是数组的升级版&#xff0c;集合中只能放置对象[object]. 数组: 在java中用来保存多个具有相同数据类型数据的容器 数组弊端&#xff1a; 1.数组只能保存…

2024AICoding公司全景图及评分

AI Coding背景 AI coding 领域的产品和公司在 2024 年开始爆发了&#xff0c;主要涉及技术进步、市场需求和开发者生态系统的变化。 本文会从技术背景&#xff0c;市场需求&#xff0c;生态以及相关评分为大家完整梳理一下相关内容。 底层技术 大规模预训练模型 技术背景&#…

C#使用OPC组件方式和AB的PLC通信

目录 一、PLC硬件配置 1、创建PLC程序 &#xff08;1&#xff09;程序工程选择 &#xff08;2&#xff09;变量和程序 2、配置程序在模拟器中运行 &#xff08;1&#xff09;打开RSLkin Classic &#xff08;2&#xff09;仿真器配置 &#xff08;3&#xff09;PLC程序…