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

目录

一、用法精讲

611、pandas.DataFrame.to_orc方法

611-1、语法

611-2、参数

611-3、功能

611-4、返回值

611-5、说明

611-6、用法

611-6-1、数据准备

611-6-2、代码示例

611-6-3、结果输出

612、pandas.DataFrame.to_dict方法

612-1、语法

612-2、参数

612-3、功能

612-4、返回值

612-5、说明

612-6、用法

612-6-1、数据准备

612-6-2、代码示例

612-6-3、结果输出

613、pandas.DataFrame.to_records方法

613-1、语法

613-2、参数

613-3、功能

613-4、返回值

613-5、说明

613-6、用法

613-6-1、数据准备

613-6-2、代码示例

613-6-3、结果输出

614、pandas.DataFrame.to_string方法

614-1、语法

614-2、参数

614-3、功能

614-4、返回值

614-5、说明

614-6、用法

614-6-1、数据准备

614-6-2、代码示例

614-6-3、结果输出

615、pandas.DataFrame.to_markdown方法

615-1、语法

615-2、参数

615-3、功能

615-4、返回值

615-5、说明

615-6、用法

615-6-1、数据准备

615-6-2、代码示例

615-6-3、结果输出

二、推荐阅读

1、Python筑基之旅

2、Python函数之旅

3、Python算法之旅

4、Python魔法之旅

5、博客个人主页
​​​​​​​

一、用法精讲

611、pandas.DataFrame.to_orc方法
611-1、语法
# 611、pandas.DataFrame.to_orc方法
pandas.DataFrame.to_orc(path=None, *, engine='pyarrow', index=None, engine_kwargs=None)
Write a DataFrame to the ORC format.New in version 1.5.0.Parameters:
path
str, file-like object or None, default None
If a string, it will be used as Root Directory path when writing a partitioned dataset. By file-like object, we refer to objects with a write() method, such as a file handle (e.g. via builtin open function). If path is None, a bytes object is returned.engine
{‘pyarrow’}, default ‘pyarrow’
ORC library to use.index
bool, optional
If True, include the dataframe’s index(es) in the file output. If False, they will not be written to the file. If None, similar to infer the dataframe’s index(es) will be saved. However, instead of being saved as values, the RangeIndex will be stored as a range in the metadata so it doesn’t require much space and is faster. Other indexes will be included as columns in the file output.engine_kwargs
dict[str, Any] or None, default None
Additional keyword arguments passed to pyarrow.orc.write_table().Returns:
bytes if no path argument is provided else None
Raises:
NotImplementedError
Dtype of one or more columns is category, unsigned integers, interval, period or sparse.ValueError
engine is not pyarrow.
611-2、参数

611-2-1、path(可选,默认值为None)str或path-like指定要写入的ORC文件的路径,如果不提供,则返回ORC格式的数据而不写入文件。

611-2-2、engine(可选,默认值为'pyarrow')字符串,指定用于写入ORC的引擎,可以是'pyarrow'或其他支持ORC格式的库(如'fastparquet'),默认为pyarrow,因为它通常提供更快的性能和更多的功能。

611-2-3、index(可选,默认值为None)布尔值,指定是否将DataFrame的索引写入文件,默认值为None,表示采用默认行为;如果设为False,则索引将不会写入文件。

611-2-4、engine_kwargs(可选,默认值为None)字典,传递给底层引擎的额外参数,这可以用于配置具体的写入选项,具体取决于所选择的引擎。

611-3、功能

        将Pandas DataFrame转换并存储为ORC文件格式,便于后续的数据查询和分析,ORC格式的优势是在存储和读取大数据时提供更好的性能和压缩效果。

611-4、返回值

        如果提供了path参数并成功写入文件,则返回None;如果没有提供path,则返回一个包含DataFrame数据的ORC格式的可序列化对象(在使用pyarrow时,通常返回一个pyarrow.Table对象)。

611-5、说明

        无

611-6、用法
611-6-1、数据准备
611-6-2、代码示例
# 611、pandas.DataFrame.to_orc方法
import pandas as pd
# 创建一个示例 DataFrame
data = {'name': ['Alice', 'Bob', 'Charlie'],'age': [25, 30, 35],'city': ['New York', 'Los Angeles', 'Chicago']
}
df = pd.DataFrame(data)
# 指定ORC文件的保存路径
path = 'example.orc'
# 将DataFrame保存到ORC文件
df.to_orc(path=path,engine='pyarrow',  # 使用 pyarrow 引擎index=True,  # 保留 DataFrame 的索引engine_kwargs={  # 可选的引擎参数,这里作为示例没有设置任何内容# 例如,可以指定压缩算法等# 'compression': 'snappy'}
)
print(f"DataFrame has been saved to {path}")
611-6-3、结果输出
612、pandas.DataFrame.to_dict方法
612-1、语法
# 612、pandas.DataFrame.to_dict方法
pandas.DataFrame.to_dict(orient='dict', *, into=<class 'dict'>, index=True)
Convert the DataFrame to a dictionary.The type of the key-value pairs can be customized with the parameters (see below).Parameters:
orientstr {‘dict’, ‘list’, ‘series’, ‘split’, ‘tight’, ‘records’, ‘index’}
Determines the type of the values of the dictionary.‘dict’ (default) : dict like {column -> {index -> value}}‘list’ : dict like {column -> [values]}‘series’ : dict like {column -> Series(values)}‘split’ : dict like {‘index’ -> [index], ‘columns’ -> [columns], ‘data’ -> [values]}‘tight’ : dict like {‘index’ -> [index], ‘columns’ -> [columns], ‘data’ -> [values], ‘index_names’ -> [index.names], ‘column_names’ -> [column.names]}‘records’ : list like [{column -> value}, … , {column -> value}]‘index’ : dict like {index -> {column -> value}}New in version 1.4.0: ‘tight’ as an allowed value for the orient argumentintoclass, default dict
The collections.abc.MutableMapping subclass used for all Mappings in the return value. Can be the actual class or an empty instance of the mapping type you want. If you want a collections.defaultdict, you must pass it initialized.indexbool, default True
Whether to include the index item (and index_names item if orient is ‘tight’) in the returned dictionary. Can only be False when orient is ‘split’ or ‘tight’.New in version 2.0.0.Returns:
dict, list or collections.abc.MutableMapping
Return a collections.abc.MutableMapping object representing the DataFrame. The resulting transformation depends on the orient parameter.
612-2、参数

612-2-1、orient(可选,默认值为'dict')字符串,指定字典的构造方式,常见的取值包括:

  • 'dict':默认,字典的键为列名,值为列的数据(以字典形式存储)。
  • 'list':字典的键为列名,值为列的数据(以列表形式存储)。
  • 'series':字典的键为列名,值为Series对象。
  • 'split':返回一个字典,包含三个键:'index'(索引)、'columns'(列名)和'data'(数据)。
  • 'records':每行作为字典,返回一个字典的列表。
  • 'index':字典的键为行索引,值为字典(每列的名称作为字典的键,每列的数据作为字典的值)。

612-2-2、into(可选,默认值为<class 'dict'>)type,指定要返回的字典类型,默认是普通字典。

612-2-3、index(可选,默认值为True)布尔值,如果为True,则在返回字典中包含行索引;如果为False,则不包含行索引。

612-3、功能

        将DataFrame转换为字典形式,方便与其他数据结构的交互或用于数据的序列化,通过不同的orient选项,可以根据需求选择合适的字典结构。

612-4、返回值

        返回一个字典,内容和结构取决于指定的orient参数,如果没有指定into参数,返回的将是标准的Python字典。

612-5、说明

        无

612-6、用法
612-6-1、数据准备
612-6-2、代码示例
# 612、pandas.DataFrame.to_dict方法
import pandas as pd
# 创建一个示例DataFrame
df = pd.DataFrame({'name': ['Myelsa', 'Bryce', 'Jimmy'],'age': [43, 6, 15]
})
# 将DataFrame转换为字典(默认)
dict_default = df.to_dict()
# 将DataFrame转换为列表格式字典
dict_list = df.to_dict(orient='list')
# 将DataFrame转换为记录格式字典
dict_records = df.to_dict(orient='records')
# 将DataFrame转换为索引格式字典
dict_index = df.to_dict(orient='index')
print('Default:', dict_default)
print('List:', dict_list)
print('Records:', dict_records)
print('Index:', dict_index)
612-6-3、结果输出
# 612、pandas.DataFrame.to_dict方法
# Default: {'name': {0: 'Myelsa', 1: 'Bryce', 2: 'Jimmy'}, 'age': {0: 43, 1: 6, 2: 15}}
# List: {'name': ['Myelsa', 'Bryce', 'Jimmy'], 'age': [43, 6, 15]}
# Records: [{'name': 'Myelsa', 'age': 43}, {'name': 'Bryce', 'age': 6}, {'name': 'Jimmy', 'age': 15}]
# Index: {0: {'name': 'Myelsa', 'age': 43}, 1: {'name': 'Bryce', 'age': 6}, 2: {'name': 'Jimmy', 'age': 15}}
613、pandas.DataFrame.to_records方法
613-1、语法
# 613、pandas.DataFrame.to_records方法
pandas.DataFrame.to_records(index=True, column_dtypes=None, index_dtypes=None)
Convert DataFrame to a NumPy record array.Index will be included as the first field of the record array if requested.Parameters:
indexbool, default True
Include index in resulting record array, stored in ‘index’ field or using the index label, if set.column_dtypesstr, type, dict, default None
If a string or type, the data type to store all columns. If a dictionary, a mapping of column names and indices (zero-indexed) to specific data types.index_dtypesstr, type, dict, default None
If a string or type, the data type to store all index levels. If a dictionary, a mapping of index level names and indices (zero-indexed) to specific data types.This mapping is applied only if index=True.Returns:
numpy.rec.recarray
NumPy ndarray with the DataFrame labels as fields and each row of the DataFrame as entries.
613-2、参数

613-2-1、index(可选,默认值为True)布尔值,指定是否将DataFrame的索引量转换为记录中的字段,如果为True,则索引会作为结构化数组的字段之一;如果为False,索引将不会包含在返回结果中。

613-2-2、column_dtypes(可选,默认值为None)字典,用于指定列的类型,如果提供,该字典的键为列名,值为对应列的类型,通常用于调整返回的结构化数组中字段的数据类型。

613-2-3、index_dtypes(可选,默认值为None)字典,用于指定索引的类型,如果提供,该字典的键为索引的名称,值为要应用于索引的类型。

613-3、功能

        将DataFrame转换为一个结构化数组,方便通过属性名的方式访问每一行的数据,这种格式通常在处理数据时非常有用,可以与NumPy和其他数据分析工具更好地集成。

613-4、返回值

        返回一个结构化数组recarray每一行表示DataFrame中的一行,每一列表示DataFrame的列。

613-5、说明

        无

613-6、用法
613-6-1、数据准备
613-6-2、代码示例
# 613、pandas.DataFrame.to_records方法
import pandas as pd
# 创建一个示例DataFrame
df = pd.DataFrame({'name': ['Myelsa', 'Bryce', 'Jimmy'],'age': [43, 6, 15]
})
# 将DataFrame转换为结构化数组(默认将索引包含在内)
structured_records_default = df.to_records()
# 将DataFrame转换为结构化数组(不包含索引)
structured_records_no_index = df.to_records(index=False)
print('Default Records:')
print(structured_records_default)
print('Records without Index:')
print(structured_records_no_index)
613-6-3、结果输出
# 613、pandas.DataFrame.to_records方法
# Default Records:
# [(0, 'Myelsa', 43) (1, 'Bryce',  6) (2, 'Jimmy', 15)]
# Records without Index:
# [('Myelsa', 43) ('Bryce',  6) ('Jimmy', 15)]
614、pandas.DataFrame.to_string方法
614-1、语法
# 614、pandas.DataFrame.to_string方法
pandas.DataFrame.to_string(buf=None, *, columns=None, col_space=None, header=True, index=True, na_rep='NaN', formatters=None, float_format=None, sparsify=None, index_names=True, justify=None, max_rows=None, max_cols=None, show_dimensions=False, decimal='.', line_width=None, min_rows=None, max_colwidth=None, encoding=None)
Render a DataFrame to a console-friendly tabular output.Parameters:
buf
str, Path or StringIO-like, optional, default None
Buffer to write to. If None, the output is returned as a string.columns
array-like, optional, default None
The subset of columns to write. Writes all columns by default.col_space
int, list or dict of int, optional
The minimum width of each column. If a list of ints is given every integers corresponds with one column. If a dict is given, the key references the column, while the value defines the space to use..header
bool or list of str, optional
Write out the column names. If a list of columns is given, it is assumed to be aliases for the column names.index
bool, optional, default True
Whether to print index (row) labels.na_rep
str, optional, default ‘NaN’
String representation of NaN to use.formatters
list, tuple or dict of one-param. functions, optional
Formatter functions to apply to columns’ elements by position or name. The result of each function must be a unicode string. List/tuple must be of length equal to the number of columns.float_format
one-parameter function, optional, default None
Formatter function to apply to columns’ elements if they are floats. This function must return a unicode string and will be applied only to the non-NaN elements, with NaN being handled by na_rep.sparsify
bool, optional, default True
Set to False for a DataFrame with a hierarchical index to print every multiindex key at each row.index_names
bool, optional, default True
Prints the names of the indexes.justify
str, default None
How to justify the column labels. If None uses the option from the print configuration (controlled by set_option), ‘right’ out of the box. Valid values areleftrightcenterjustifyjustify-allstartendinheritmatch-parentinitialunset.max_rows
int, optional
Maximum number of rows to display in the console.max_cols
int, optional
Maximum number of columns to display in the console.show_dimensions
bool, default False
Display DataFrame dimensions (number of rows by number of columns).decimal
str, default ‘.’
Character recognized as decimal separator, e.g. ‘,’ in Europe.line_width
int, optional
Width to wrap a line in characters.min_rows
int, optional
The number of rows to display in the console in a truncated repr (when number of rows is above max_rows).max_colwidth
int, optional
Max width to truncate each column in characters. By default, no limit.encoding
str, default “utf-8”
Set character encoding.Returns:
str or None
If buf is None, returns the result as a string. Otherwise returns None.
614-2、参数

614-2-1、buf(可选,默认值为None)字符串或None,指定输出的目标,如果为None,则返回格式化后的字符串;如果为一个类文件对象,会将结果写入该对象。

614-2-2、columns(可选,默认值为None)列表或None,指定要显示的列,如果为None,则显示所有列。

614-2-3、col_space(可选,默认值为None)整数或None,指定列的最小空间,如果指定,该参数可以用于调整列宽。

614-2-4、header(可选,默认值为True)布尔值,指定是否显示列标题。

614-2-5、index(可选,默认值为True)布尔值,指定是否显示行索引。

614-2-6、na_rep(可选,默认值为'NaN')字符串,指定缺失值的表示形式。

614-2-7、formatters(可选,默认值为None)字典或None,指定列格式化的函数,键是列名,值是格式化函数。

614-2-8、float_format(可选,默认值为None)字符串或None,指定浮点数的格式化方式,例如,'${:.2f}'将浮点数格式化为货币格式。

614-2-9、sparsify(可选,默认值为None)布尔值,是否在打印MultiIndex时使用稀疏格式,如果为True,则会为MultiIndex进行格式化处理。

614-2-10、index_names(可选,默认值为True)布尔值,指定是否显示索引名称。

614-2-11、justify(可选,默认值为None)字符串或None,指定列标题的对齐方式,如'left'、'right'、'center'。

614-2-12、max_rows(可选,默认值为None)整数或None,指定显示的最大行数。

614-2-13、max_cols(可选,默认值为None)整数或None,指定显示的最大列数。

614-2-14、show_dimensions(可选,默认值为False)布尔值,是否显示DataFrame的维度信息。

614-2-15、decimal(可选,默认值为'.')字符串,指定小数点的符号,常用于处理小数表示。

614-2-16、line_width(可选,默认值为None)整数或None,指定输出行的最大宽度,如果超过该限制,会自动换行。

614-2-17、min_rows(可选,默认值为None)整数或None,强制至少显示的行数。

614-2-18、max_colwidth(可选,默认值为None)整数或None,指定列的最大宽度,如果某列内容超过该宽度,则内容会被截断。

614-2-19、encoding(可选,默认值为None)字符串或None,指定输出字符串的编码方式,仅适用于将输出写入文件时。

614-3、功能

        提供了灵活的选项来格式化DataFrame的输出,以便更好地展示数据,这对于调试或数据审查非常有用。

614-4、返回值

        返回一个字符串(如果buf为None),或将结果写入到buf指定的文件对象中。

614-5、说明

        无

614-6、用法
614-6-1、数据准备
614-6-2、代码示例
# 614、pandas.DataFrame.to_string方法
import pandas as pd
# 创建一个示例DataFrame
df = pd.DataFrame({'name': ['Myelsa', 'Bryce', 'Jimmy'],'age': [43, 6, 15],'salary': [50000, None, 70000]
})
# 使用to_string方法显示DataFrame
output = df.to_string(index=False)
print(output, end='\n\n')
# 输出DataFrame,限制最大列宽为10
output_limited_colwidth = df.to_string(max_colwidth=10)
print(output_limited_colwidth)
614-6-3、结果输出
# 614、pandas.DataFrame.to_string方法
#   name  age  salary
# Myelsa   43 50000.0
#  Bryce    6     NaN
#  Jimmy   15 70000.0
# 
#      name  age   salary
# 0  Myelsa   43  50000.0
# 1   Bryce    6      NaN
# 2   Jimmy   15  70000.0
615、pandas.DataFrame.to_markdown方法
615-1、语法
# 615、pandas.DataFrame.to_markdown方法
pandas.DataFrame.to_markdown(buf=None, *, mode='wt', index=True, storage_options=None, **kwargs)
Print DataFrame in Markdown-friendly format.Parameters:
buf
str, Path or StringIO-like, optional, default None
Buffer to write to. If None, the output is returned as a string.mode
str, optional
Mode in which file is opened, “wt” by default.index
bool, optional, default True
Add index (row) labels.storage_options
dict, optional
Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib.request.Request as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec.open. Please see fsspec and urllib for more details, and for more examples on storage options refer here.**kwargs
These parameters will be passed to tabulate.Returns:
str
DataFrame in Markdown-friendly format.NotesRequires the tabulate package.
615-2、参数

615-2-1、buf(必须)字符串或None,指定输出的目标,如果为None,则返回格式化后的字符串;如果为一个类文件对象,会将结果写入该对象。

615-2-2、mode(可选,默认值为'wt')字符串,指定写入模式,常用的值包括:

  • 'wt':文本模式写入。
  • 'wb':二进制模式写入。

615-2-3、index(可选,默认值为True)布尔值,指定是否显示行索引。

615-2-4、storage_options(可选,默认值为None)字典或None,提供用于读取或写入数据的额外选项,主要用于支持不同的存储后端(例如,云存储)。

615-2-5、**kwargs(可选)其他关键字参数,将传递给Markdown格式化的内部函数,这些参数可以包括控制列格式化、宽度等选项。

615-3、功能

        允许用户将Pandas DataFrame方便地转换为Markdown格式,输出为易于阅读的表格,适用于文档、报告或处理Markdown文本文件时。

615-4、返回值

        返回一个字符串(如果buf为None),或将结果写入到buf指定的文件对象中。

615-5、说明

        无

615-6、用法
615-6-1、数据准备
615-6-2、代码示例
# 615、pandas.DataFrame.to_markdown方法
import pandas as pd
# 创建一个示例DataFrame
df = pd.DataFrame({'name': ['Myelsa', 'Bryce', 'Jimmy'],'age': [43, 6, 15],'salary': [50000, 60000, 70000]
})
# 使用to_markdown方法生成Markdown格式的表格
markdown_output = df.to_markdown(index=False)
print(markdown_output)
# 将Markdown输出写入文件
with open('output.md', 'w') as f:df.to_markdown(buf=f, index=False)
615-6-3、结果输出
# 615、pandas.DataFrame.to_markdown方法
# | name   |   age |   salary |
# |:-------|------:|---------:|
# | Myelsa |    43 |    50000 |
# | Bryce  |     6 |    60000 |
# | Jimmy  |    15 |    70000 |

二、推荐阅读

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

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

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

相关文章

使用日志服务告警为您的OSS保驾护航

日志服务SLS告警作为一站式运维告警平台&#xff0c;为OSS的访问提供了定制化的告警规则。您只需要在日志服务控制台进行简单配置&#xff0c;即可完成对OSS访问指标的监控&#xff0c;并在指标出现异常时及时收到告警通知。 场景描述 客户A是一家多媒体公司&#xff0c;主要…

【机器学习】探索机器学习在医疗影像分析中的应用

1. &#x1f680; 引言1.1 &#x1f680; 医疗影像分析的现状与发展趋势1.2 &#x1f4dc; 机器学习在医疗影像分析中的核心概念1.3 &#x1f3c6; 医疗影像分析在临床应用中的作用 2. &#x1f50d; 医疗影像分析的演变与创新2.1 &#x1f31f; 医疗影像分析的发展历程2.2 &am…

通过实时可视性转变云安全

Upwind首席执行官 Amiram Shachar 讨论了混合和多云环境中云安全的复杂性。 他概述了深入了解配置和实时洞察的必要性&#xff0c;以实现敏捷性和安全性之间的平衡。 还分享了解决错误配置和确保合规性的策略&#xff0c;建议在云部署中采取主动的风险管理方法。 随着混合云…

安装Spark-单机部署,Standalone集群部署,Spark on Yarn实现

目录 单机部署spark本地模式部署 Anaconda部署Python(3台机器都需要) Spark本地模式部署 Spark Python Shell Spark的Standalone集群部署 Standalone集群架构 Standalone集群部署 Standalone集群启动 Standalone集群测试 Spark on YARN的实现 Spark on YARN&#xf…

kubernetes集群公共服务 Harbor

首先&#xff0c;还是需要新创建一个虚拟机&#xff0c;就像之前一样&#xff0c;然后启动虚拟机,设置主机名和网络&#xff0c;网关&#xff0c;DNS等。 接下来检查防火墙,selinux是否关闭&#xff0c;以及是否做了时钟同步。 一、 docker-ce安装 1.1 获取YUM源 使用阿里云开源…

自动驾驶系列—揭秘毫米波雷达:自动驾驶的眼睛如何看穿复杂环境?

&#x1f31f;&#x1f31f; 欢迎来到我的技术小筑&#xff0c;一个专为技术探索者打造的交流空间。在这里&#xff0c;我们不仅分享代码的智慧&#xff0c;还探讨技术的深度与广度。无论您是资深开发者还是技术新手&#xff0c;这里都有一片属于您的天空。让我们在知识的海洋中…

SpringBoot开发——SpringSecurity安全框架17个业务场景案例(二)

文章目录 一、Spring Security 常用应用场景介绍二、Spring Security场景案例6、CSRF 保护(CSRF Protection)6.1 Spring Security 配置6.2 业务逻辑代码7、密码编码(Password Encoding)7.1 Spring Security 配置7.2 业务逻辑代码7.3 控制器8、方法级安全性(Method Securit…

李飞飞:我不知道什么是AGI

图片来源&#xff1a;Stanford University 你对人工通用智能&#xff08;AGI&#xff09;感到困惑吗&#xff1f;这就是 OpenAI 执着于最终以“造福全人类”的方式创造的东西。你可能想认真对待他们&#xff0c;因为他们刚筹集了 66 亿美元以更接近这个目标。 但如果你仍然在…

国外电商系统开发-运维系统文件上传-快速上传

点击【快速】&#xff0c;意思是速度快&#xff0c;步骤简单 在上面的输入中&#xff0c;是输入您要把您的文件传到远程服务器的哪个目录下&#xff0c;注意&#xff0c;比如您选择了10个服务器&#xff0c;10个服务器的目标路径都一样&#xff0c;那么您在这里点击【快速】即可…

《动手学深度学习》Pytorch 版学习笔记一:从预备知识到现代卷积神经网络

前言 笔者有一定的机器学习和深度学习理论基础&#xff0c;对 Pytorch 的实战还不够熟悉&#xff0c;打算入职前专项突击一下 本文内容为笔者学习《动手学深度学习》一书的学习笔记 主要记录了代码的实现和实现过程遇到的问题&#xff0c;不完全包括其理论知识 引用&#x…

Windows VSCode 配置 Java 环境 (Maven)

一、简介 这篇博客介绍一下 Windows 环境中&#xff0c;使用 VSCode 编译、调试、启动、运行、发布 Java 项目&#xff08;Maven&#xff09;。 二、Maven 安装 如果已经安装过 Maven 可以跳过此步骤。Maven 的安装&#xff0c;可以参照博客 Windows 安装 Maven 并配置环境变…

织物布匹疵点检测数据集,布匹缺陷检测数据集 标注工具:LabelImg 数量:已标注1084张(5类);未标注:2000余张

织物疵点检测数据集&#xff0c;布匹缺陷检测数据集 标注工具&#xff1a;LabelImg 数量&#xff1a;已标注1084张(5类&#xff09;&#xff1b;未标注&#xff1a;2000余张 简介&#xff1a;织物疵点检测是一种基于计算机视觉技术的自动化检测方法&#xff0c;旨在通过对织物图…

【STM32开发之寄存器版】(七)-PWM脉冲宽度调制

一、前言 PWM简介 PWM&#xff08;脉宽调制&#xff09;是一种通过调节信号的脉冲宽度来控制功率输出的技术。其基本原理是保持固定频率的信号&#xff0c;将其高电平和低电平的持续时间调整&#xff0c;达到控制平均功率的目的。应用方面&#xff0c;PWM广泛用于电机控制、LED…

C语言基础题(大合集1)

1. Hello World! 写一个程序 &#xff0c; 在控制台上输出 &#xff1a; Hello World! #include <stdio.h> int main() {printf("Hello World!\n");return 0; }main 函数是程序的入口 &#xff0c; 一个工程有且仅有一个 main函数 代码是从 main 函数的第一行开…

数学概念算法-打印100以内的素/质数

素数&#xff1a;只能被1和自己整除的数 暴力破解 埃氏筛选 找到第一个数字&#xff0c;如果它是素数&#xff0c;则把它的倍数全部划掉 比如数字2是素数&#xff0c;那么 4,6,8,10,12。这些数字肯定不是素数&#xff0c;所以不用再考虑&#xff0c;直接划掉即可 第二步&#…

SQL注入靶场sqli-labs less-4

sqli-labs靶场第三关less-4 1、确定注入点 http://192.168.128.3/sq/Less-4/?id1 http://192.168.128.3/sq/Less-4/?id2 有不同回显&#xff0c;判断可能存在注入&#xff0c; 2、判断注入类型 输入 http://192.168.128.3/sq/less-4/?id1 and 11 http://192.168.128.3/sq/l…

C++(异常)

目录 C语言传统的处理错误的方式 传统的错误处理机制 C异常概念 异常的使用 异常的抛出和捕获 异常的抛出和匹配原则 在函数调用链中异常栈展开匹配原则 异常的重新抛出 异常安全 异常规范 自定义异常体系 C标准库的异常体系 异常的优缺点 C异常的优点 C异常的缺…

DB_GPT excel研究

DB_GPT excel研究 摘要视频简介源码分析excel文档上传预处理对话 摘要 DB_GPT集成了很多对话方式&#xff0c;其中呢就有关于excel对话的模块&#xff0c;我搜集各大web好像都没有关于这个模块的研究&#xff0c;于是乎就自行研究了对于excel对话的的功能 如果是想看与数据库…

Golang | Leetcode Golang题解之第462题最小操作次数使数组元素相等II

题目&#xff1a; 题解&#xff1a; func partition(a []int, l, r int) int {x : a[r]i : l - 1for j : l; j < r; j {if a[j] < x {ia[i], a[j] a[j], a[i]}}a[i1], a[r] a[r], a[i1]return i 1 }func randomPartition(a []int, l, r int) int {i : rand.Intn(r-l1…

毕设 大数据电影数据分析与可视化系统(源码+论文)

文章目录 0 前言1 项目运行效果2 设计概要3 最后 0 前言 &#x1f525;这两年开始毕业设计和毕业答辩的要求和难度不断提升&#xff0c;传统的毕设题目缺少创新和亮点&#xff0c;往往达不到毕业答辩的要求&#xff0c;这两年不断有学弟学妹告诉学长自己做的项目系统达不到老师…