小白学Python
文章平均质量分 59
...
PerpetualLearner
这个作者很懒,什么都没留下…
展开
-
理解Instance, Class, Static Methods in Python
Overview理解decorator pattern in PythonHow many types of methods in PythonGenerally, there are three types of methods in Python:Instance MethodsClass MethodsStatic MethodsKnowing the differences isn’t always required to code basic Python scrip..原创 2021-04-24 14:27:40 · 1014 阅读 · 0 评论 -
理解offset in Python
Overview在Python函数中,经常出现offset相关参数。大概理解是与频率、位置之类的概念相关,具体怎么理解呢?Offset alias in PandasFrom Pandas (notes its pandas not python) docs: Time series / date functionalityA number of string aliases are given to useful common time series frequencies. We wi..原创 2021-04-24 14:25:11 · 2535 阅读 · 1 评论 -
理解pct_change()&shift() in Python
Overview理解offset in Pythonpct_change(periods=1, fill_method='pad', limit=None, freq=None, **kwargs)Percentage change between the current and a prior element.fill_method mean how to handle NAs before computing percent changes;limit also about the..原创 2021-04-24 14:23:54 · 1122 阅读 · 0 评论 -
理解reduce(), map(), filter(), anonymous in Python
OverviewWhat is an anonymous function/method or lambda?Anonymous functionAn anonymous method is a method without a name, i.e. not bound to an identifier like when we define a method using def method:.Anonymous functions are often arguments being pa..原创 2021-04-23 21:03:08 · 201 阅读 · 0 评论 -
理解Inline Image||Reference Image||Html Image||Size Image||Align Image in markdown
OverviewFrom [1], there are many types for markdown image.Inline & Reference are the two style for image in markdown.Inline ImageAn inline image is a graphic image that is inserted into a web page to add visual appeal, provide information or to..原创 2021-04-23 21:02:11 · 543 阅读 · 0 评论 -
理解decorator pattern in Python
OverviewFrom [1], Decorator pattern (or simply called a decorator) is a design pattern.Decoraters are simply functions, it performs a task, the difference to the common function is that decorators apply logic or change the behavior of other functions...原创 2021-04-23 20:56:36 · 246 阅读 · 0 评论 -
理解subplot() vs. subplots() in matlabplot
subplotmatplotlib.pyplot.subplot(*args, **kwargs)Add an Axes to the current figure or retrieve an existing Axes.理解Axes in matplotlib原创 2021-04-13 09:55:50 · 274 阅读 · 0 评论 -
再看Exception in Python
Exceptions versus Syntax ErrorsSyntax errors occur when the parser detects an incorrect statement.Exception errors occurs whenever syntactically correct Python code results in an error.Raising an ExceptionWe can use raise to throw an exception if a..原创 2021-03-27 10:48:15 · 204 阅读 · 1 评论 -
理解Sphinx about Python docstring
OverviewFrom numpydoc, Numpy’s documentation uses several custom extensions to Sphinx, these are shipped in this numpydoc package, in case you want to make use of them in third-party projects.SphinxA sphinx is a mythical creature with the head of a ..原创 2021-03-27 10:32:50 · 177 阅读 · 0 评论 -
理解version of Python Package
OverviewMaybe the question in English is :How to define the version information about a Python package?Other questions to be favor for understanding:What is module and How to publish module in Python?There are many different schemes that can be ..原创 2021-03-27 10:31:04 · 236 阅读 · 0 评论 -
如何用Python读写json文件
OverviewThe question maybe expressed in english :How to update a JOSN file in Python ?About handleIf you just open a json file, and update the content, you will find that the requested value is not being changed but the entire set of values is be..原创 2021-03-20 10:42:10 · 316 阅读 · 1 评论 -
What is module and How to publish module in Python?
Overview理解module, library, package in PythonIn Python, a module is a self-contained file with Python statements and definitions, file.py can be considered as a module named file.“PyPI” should be pronounced like “pie pea eye”, ***Python Package Index..原创 2021-03-20 10:41:01 · 171 阅读 · 1 评论 -
理解Python wheels
OverviewreferenceReferencesReal Python: What are Python Wheels and Why should you care?Python Docs: Distributing Python Modules原创 2021-03-20 10:39:49 · 177 阅读 · 0 评论 -
深入理解document & comment in Python
OverviewCode is more often read than written — Guido Van RossumIn general, commenting is describing your code to developer(code tells you how, Comments tell you why);Documentinig code is describing its use and functionality to your users.Commen..原创 2021-03-20 10:38:30 · 498 阅读 · 1 评论 -
理解 setup.py in Python
What is setup.pyReference is goodReferencesGitHub: setup.py for humanWhat is setup.py? on Stack OverflowPython Docs: Installing Python ModuleOfficial Python Packaging User GuideThe Hitchhiker’s Guide to PackagingCookiecutter template for a P..原创 2021-03-20 10:37:25 · 206 阅读 · 0 评论 -
理解module, script, library, package in Python
OverviewPython modules and Python packages are two mechanisms that facilitate modular programming.A script is a Python file that’s intended to be run directly.A module is a Python file that’s intended to be imported into scripts or other modules.A pa..原创 2021-03-20 10:36:07 · 520 阅读 · 0 评论 -
(20210208已解决)numexpr.utils:NumExpr defaulting to 4 threads
Overviewlogging.info总是显示INFO:numexpr.utils:NumExpr defaulting to 4 threadsnumexpr.utilsGitHub OfficialWebNumExpr is a fast numerical expression evaluator for NumPy.With it, expressions that operate on arrays are accelerated and use less memory..原创 2021-03-07 12:31:25 · 2205 阅读 · 3 评论 -
(202100219已解决)pandas删除全为0值的列
Overviewdf.loc[:, (df != 0).any(axis=0)]ReferenceHow do I delete a column that contains only zeros in Pandas?原创 2021-02-21 10:08:52 · 4838 阅读 · 0 评论 -
(20210219已解决)Pandas禁止科学计数法
Overviewpd.set_option('display.float_format',lambda x : '%.3f' % x)Referencespandas禁用科学计数法、输出时显示全部行原创 2021-02-21 10:07:12 · 3151 阅读 · 0 评论 -
(20210208已解决)numexpr.utils:NumExpr defaulting to 4 threads
Overviewlogging.info总是显示INFO:numexpr.utils:NumExpr defaulting to 4 threadsnumexpr.utilsGitHub OfficialWebNumExpr is a fast numerical expression evaluator for NumPy.With it, expressions that operate on arrays are accelerated and use less memory..原创 2021-02-10 17:04:27 · 2896 阅读 · 1 评论 -
理解VML||MKL
OverviewFrom NumExpr, it could make use of Intel’s VML(Vector Math Library, notmally integrated in its Math Kernel Library(MKL))原创 2021-02-10 17:03:16 · 539 阅读 · 0 评论 -
理解syntactical sugar
OverviewIf a language provides convenient, compact shortcuts, then those shortcuts may be described as syntactical sugar, a term coined in 1964.The built-in dictionary data structure in Python is syntactic sugar for an associative matrix/list.Syntac..原创 2021-02-08 09:22:28 · 218 阅读 · 0 评论 -
理解Python系统下的时间格式
Overviewpandas/numpy/datetime/time,这四个module是常用的时间相关模块。timestamp,datetime,str是三大类常用的数据类型。需要理顺彼此之间错综复杂的关系。The Python world has a number of avaiable representations of dates, times, deltas, and timespans.Native Python dates and times: datetime and dat..原创 2021-01-29 20:48:15 · 214 阅读 · 0 评论 -
将DataFrame作为邮件正文HTML发送 in Python
OverviewTo convert this question into english, maybe:How to convert a DataFrame into a petty HTML table and send it over Email, like this one here.From R1,there is a module named pretty_html_table .pretty_html_tableThe objective of this package is..原创 2021-01-29 20:32:57 · 1428 阅读 · 1 评论 -
(20210129已解决)SyntaxError: Non-ASCII character ‘\xe6‘ in file filename.py , but no encoding decla
Overview如题,运行程序出现上述提示。原因解析这个问题经常是出现在crontab设置运行python时。同样的程序,在IDE中直接运行是正常的。The reason why it works differently in console and in the IDE is, likely, because of different default encoding set. You can check it by running:Limport sysprint(sys.getd..原创 2021-01-29 20:28:51 · 673 阅读 · 1 评论 -
(20210129已解决)Pandas通过某列值包含特定字符串过滤行
OverviewMaybe expressed with english by:how to filter rows containing a string pattern from a Pandas dataframe?问题解析只保留某些行,其中某列包含特定的字符串。解决方案df[df['col_name'].str.contains('str_pattern')]如果包含多种str_pattern:df[df['col_name'].str.contains('sp1'..原创 2021-01-29 20:27:13 · 1580 阅读 · 1 评论 -
理解clip函数in Python
pandas.Series.clipSeries.clip(lower=None, upper=None, axis=None, inplace=False, *args, **kwargs)Trim values at input threshold(s).Assigns values outside boundary to boundary values. Thresholds can be singular values or array like.ParamsTypeMea..原创 2021-01-23 09:28:17 · 778 阅读 · 2 评论 -
理解raise in Python
raise statementraise_stmt ::= "raise" [expression ["from" expression]]If no expressions are present, raise re-raises the last exception that was active in the current scope.Two ways for use# Firstif something: raise Exception("some word")# Se..原创 2021-01-23 09:28:28 · 1149 阅读 · 0 评论 -
理解sftp in Python||paramiko
FTPThe File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network.FTP is built on a client-server model architecture using separate control and data connections ..原创 2021-01-01 21:58:50 · 212 阅读 · 0 评论 -
再次理解websocket in Python
websocekt《理解full-duplex||IETF||RFC||Web IDL||W3C》《RFC6455》《廖雪峰的官方网站》WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.The WebSocket protocol was standardized by the IETF as R..原创 2020-12-21 09:35:54 · 188 阅读 · 1 评论 -
再次理解asyncio/await syntax and asyncio in Python
Overviewasynchronous : 异步concurrent : 并发coroutine : 协程thread : 线程parallelism : 并行multiprocess : 多进程asyncio/await syntaxPEP492 – Coroutines with async and await syntaxThe PEP492 is proposed to make coroutines a proper standalone concept in Py..原创 2020-12-19 19:52:41 · 350 阅读 · 1 评论 -
python从url下载并打开tar.gz文件
archive fileAn archive file is a file that is composed of one or more computer files along with metadata.Archive files are used to collect multiple data files together into a single file for easier portability and storage, or simply to compress files t..原创 2020-12-11 20:41:47 · 2306 阅读 · 2 评论 -
(20201202已解决)有没有dict字典转url的Python 库
问题描述如题,url中经常会有各种参数,参数很容易写成dict形式,如果直接放到url中,代码会很长,不简洁。有没有可以将dict转换成url的模块。解决方案还真有。urllib.parse.urlencode()urllibThe Python Standard : urllib廖雪峰的官方网站urllib is a package that collects several modules for working with URLs:urllib.request fo..原创 2020-12-07 09:20:45 · 482 阅读 · 0 评论 -
Strategy Libraries in Python on Quant
Stock_Analysis_For_QuantgithubThis is Stock Analysis project in Excel, Power BI, Matlab, Python, and R language with different types of analysis such as data analysis, technical analysis, fundamental analysis, quantative analysis, and different types..原创 2020-12-07 09:21:09 · 313 阅读 · 1 评论 -
Technical Analysis library in Python on quant
pytigithub最后更新停止在2018年5月.This library contains various financial technical indicators that can be used to analyze data.Deep-Convolution-Stock-Technical-Analysisgithub最后更新停止在2017.7Use Deep Convolutional Neural Networks (CNNs) to model the sto..原创 2020-12-07 09:20:55 · 631 阅读 · 0 评论 -
(20201201- 问题已解决)request爬虫beautifulsoup无法提取tbody
问题描述爬虫任务中,所需内容在:<table class="table_search_"> <tbody> <tr>...</tr> <tr>...</tr> <tr>...</tr>可以定位到table class="table_search_",但是没有想要的内容。即,无法提取tbody内容。问题解析[爬虫]xpath无法定位tbo..原创 2020-12-05 15:11:21 · 4610 阅读 · 1 评论 -
理解lxml module in Python
OverviewhomepagePython 爬虫利器三之 Xpath 语法与 lxml 库的用法The ElementTree XML API in PythonThe lxml XML toolkit is a Pythonic binding for the C libraries libxml2 and libxslt. It is unique in that it combines the speed and XML feature completeness of these l..原创 2020-12-05 09:43:30 · 188 阅读 · 0 评论 -
深入理解conda||conda 安装不同版本Python
Overview《深入理解difference conda vs. pip || venv||virtualenv||pipenv||poetry》pip用于安装python module,virtualenv&env用于创建python 虚拟环境,两者都是建立在已有的python interpreter之后。conda兼备包安装和虚拟环境创建的功能,同时可以安装不同版本的python interpreter。condaPackage, dependency and envir..原创 2020-12-05 09:42:08 · 1801 阅读 · 0 评论 -
深入理解Virtual Environment Virtualenv in Python
virtual environmentPEP405 – Python Virtual EnvironmentsThe utility of Python virtual Environments has already been well established by the popularity of existing third-party virtual-environment tools, primarily IanBickingIan BickingIanBicking's virtu..原创 2020-12-04 22:33:20 · 550 阅读 · 1 评论 -
深入理解difference conda vs. pip || venv||virtualenv||pipenv||poetry
OverviewConda : Package, dependecy and environment management for any language-Python, R, Ruby, Lua, Scala, Java, JavaScript, C/C++, FORTRAN, and more.pip : pip is the package installer for Python.Conda and pip are often considered as being nearly i..原创 2020-12-04 22:32:25 · 935 阅读 · 1 评论