<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Anders's Blog]]></title><description><![CDATA[似静而动，荣辱不惊；动静相行，心致，行随，仁智合一，远见卓识者！]]></description><link>https://blog.csdn.net/itanders</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; itanders]]></copyright><item><title><![CDATA[用yield关键字创建生成器]]></title><link>https://blog.csdn.net/itanders/article/details/88873928</link><guid>https://blog.csdn.net/itanders/article/details/88873928</guid><author>itanders</author><pubDate>Thu, 28 Mar 2019 17:31:24 +0800</pubDate><description><![CDATA[Python使用 生成器(generator) 对延迟操作提供了支持。所谓延迟操作，是指在需要的时候才产生结果，而不是立即产生结果。这也是生成器的主要好处。

什么是生成器？

生成器其实是一种特殊的迭代器(iterator)，但是不需要像迭代器一样实现__iter__()和__next__()方法，简单的说生成器是通过一个或多个yield表达式构成的函数，如果一个函数包含yield关键字，这个函...]]></description><category></category></item><item><title><![CDATA[Python中的迭代器与可迭代]]></title><link>https://blog.csdn.net/itanders/article/details/88871191</link><guid>https://blog.csdn.net/itanders/article/details/88871191</guid><author>itanders</author><pubDate>Thu, 28 Mar 2019 16:03:13 +0800</pubDate><description><![CDATA[很多人在听到迭代器与可迭代这两个名词时往往会搞不清楚，甚至认为他们是一样的，但是实际上他们是不同的概念。
我们先来直观的区分这两者有什么不同。
可迭代 (iterable)：如果一个对象具备有__iter__() 或者 __getitem__()其中任何一个魔术方法的话，这个对象就可以称为是可迭代的。其中，__iter__()的作用是可以让for循环遍历，而__getitem__()方法可以让实例...]]></description><category></category></item><item><title><![CDATA[python的短逻辑]]></title><link>https://blog.csdn.net/itanders/article/details/88858466</link><guid>https://blog.csdn.net/itanders/article/details/88858466</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:33:34 +0800</pubDate><description><![CDATA[python中的与(and)和或(or)都是短路的与或，短路指的是当通过第一个值能判断出结果时，就不再去查看第二个值了。
Python支持布尔类型的数据，布尔类型只有True和False两种值，但是布尔类型有以下几种运算：
与(and)运算：对于与运算，由于要求两个都为True结果才为True，所以如果与运算的第一个值是False，这时无论第二个值是什么，最终结果都会是False。因此与运算的第一...]]></description><category></category></item><item><title><![CDATA[循环体与else语句]]></title><link>https://blog.csdn.net/itanders/article/details/88858443</link><guid>https://blog.csdn.net/itanders/article/details/88858443</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:32:05 +0800</pubDate><description><![CDATA[大家一定非常熟悉else关键字语句，else通常是用来配合if语句使用的，但是在Python的else语句并不只能用在if语句之后，还可以用在循环语句甚至try异常处理语句中，这虽然不是什么秘密，但是很多人没有发现它的好处。
for &amp; else
默认情况下，只有当for循环语句正常执行后，最后才会执行else语句。
for i in list("abcdefg"):
    print(...]]></description><category></category></item><item><title><![CDATA[Python变量的作用域]]></title><link>https://blog.csdn.net/itanders/article/details/88858422</link><guid>https://blog.csdn.net/itanders/article/details/88858422</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:30:32 +0800</pubDate><description><![CDATA[Python程序有各种各样的命名空间，它指的是在该程序段内一个特定的名称是独一无二的，它和其它同名的命名空间是无关的。
在Python中每一个函数都有自己的命名空间，如果在函数体外部，也就是主程序范围内定义一个变量a，然后在函数体内也定义一个变量a，那么两者指带的是不同的变量。但是要知道的是场景总是多变的，假设我需要在函数体内也访问并修改一个定义在主程序范围内的变量是否可以呢？
先来看一个例子，我...]]></description><category></category></item><item><title><![CDATA[用wordcloud和jieba生成中文词云]]></title><link>https://blog.csdn.net/itanders/article/details/88858415</link><guid>https://blog.csdn.net/itanders/article/details/88858415</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:29:52 +0800</pubDate><description><![CDATA[WordCloud是Python中一个非常优秀的第三方词云展示库，但是处理中文就不怎么能胜任，因为中文通常包含着一整句话，尽管在WordCloud里虽然也有process_text()方法用于把很长的文字做分隔，但这个方法本身是根据英文文本分词设计的，所以对于中文字的展示必须要配合更适合做中文分词处理的jieba分词库来操作效果更佳，今天就拿这两个库配合一起展示下小说《三国演义》中，四个字成语中那...]]></description><category></category></item><item><title><![CDATA[Python之jieba中文分词库]]></title><link>https://blog.csdn.net/itanders/article/details/88858376</link><guid>https://blog.csdn.net/itanders/article/details/88858376</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:27:37 +0800</pubDate><description><![CDATA[jieba分词是Python中目前最受欢迎的中文分词库，他有许多特点，为了便于介绍直接引用官方介绍如下。


支持三种分词模式：

精确模式，试图将句子最精确地切开，适合文本分析；
全模式，把句子中所有的可以成词的词语都扫描出来，速度非常快，但是不能解决歧义；
搜索引擎模式，在精确模式的基础上，对长词再次切分，提高召回率，适合用于搜索引擎分词。



支持繁体分词


支持自定义词典


MIT ...]]></description><category></category></item><item><title><![CDATA[Python之WordCloud词云库]]></title><link>https://blog.csdn.net/itanders/article/details/88858355</link><guid>https://blog.csdn.net/itanders/article/details/88858355</guid><author>itanders</author><pubDate>Wed, 27 Mar 2019 23:26:11 +0800</pubDate><description><![CDATA[WordCloud（词云）是Python中一个非常优秀的第三方词云展示库，WordCloud以词语为基本单位，根据你给出的字符串，对词频进行统计，然后以不同的大小显示出来。说的直接点就是它可以更加直观和艺术的实现词频的可视化。
首先，逻辑上来说，生成一个漂亮的词云文件主要以如下3个过程来完成：


配置对象参数


加载词云文本


输出词云文件 （如果不加说明默认的图片大小为400 * 200）...]]></description><category></category></item><item><title><![CDATA[pandas中map和applymap及apply的区别]]></title><link>https://blog.csdn.net/itanders/article/details/88764457</link><guid>https://blog.csdn.net/itanders/article/details/88764457</guid><author>itanders</author><pubDate>Sat, 23 Mar 2019 17:14:51 +0800</pubDate><description><![CDATA[在pandas中，针对于行或者列又或者是每个元素的操作很容易让人混淆，下面我们来看看分别对应的几个函数区别。
apply()
apply()是pandas里DataFrame的函数，可以针对DataFrame中的行数据或列数据应用操作。

注意：这里的apply是应用到每一行或者每一列操作，有专门的axis可以指定，默认是axis=0.

import pandas as pd
import nu...]]></description><category></category></item><item><title><![CDATA[在matplotlib中创建子图的多种方式]]></title><link>https://blog.csdn.net/itanders/article/details/88763245</link><guid>https://blog.csdn.net/itanders/article/details/88763245</guid><author>itanders</author><pubDate>Sat, 23 Mar 2019 16:24:48 +0800</pubDate><description><![CDATA[在用Matplotlib绘制图像时，有时候需要从多个角度对数据进行对比。为此子图的概念便提了出来，子图可以在较大的图形中同时放置一组较小的坐标轴。这些子图可能是画中画、网格图，或者是其他更复杂的布局形式。
创建子图常用的可以有如下三种方式。

使用add_subplot()面向对象的方式来创建子图

使用面向对象的方式创建子图前，需要创建一个figure对象，如fig = plt.figure()...]]></description><category></category></item><item><title><![CDATA[路径处理库pathlib使用详解]]></title><link>https://blog.csdn.net/itanders/article/details/88754606</link><guid>https://blog.csdn.net/itanders/article/details/88754606</guid><author>itanders</author><pubDate>Sat, 23 Mar 2019 00:52:23 +0800</pubDate><description><![CDATA[在编程中处理文件的读写操作时免不了要和文件路径打交道，甚至有时候为了完成某些场景功能会变的有些繁琐，以前在Python中操作文件路径，我们更多的时候是使用os模块。
而到了Python3时代后，Python3的系统标准库pathlib模块的 Path 对路径的操作会更简单。甚至可以说pathlib已经可以完全替代os.path，它完全采用面向对象的编程方式，因为Python 文档给它的定义是 Ob...]]></description><category></category></item><item><title><![CDATA[匿名函数lambda]]></title><link>https://blog.csdn.net/itanders/article/details/88752184</link><guid>https://blog.csdn.net/itanders/article/details/88752184</guid><author>itanders</author><pubDate>Fri, 22 Mar 2019 22:12:14 +0800</pubDate><description><![CDATA[在Python中有个匿名函数特性非常的便捷和有用，用关键字lambda就可以声明一个匿名函数，所以很多时候直接称呼为lambda函数。
每次介绍新特性的时候，我们都要反问什么是lambda函数呢？因为又叫匿名函数，所以是指没有声明函数名称的函数，它和平时我们定义普通函数使用def关键字不同，
lamda函数的声明语法如下：
lambda argument_list: expression

其中，...]]></description><category></category></item><item><title><![CDATA[python之datetime模块]]></title><link>https://blog.csdn.net/itanders/article/details/88720642</link><guid>https://blog.csdn.net/itanders/article/details/88720642</guid><author>itanders</author><pubDate>Thu, 21 Mar 2019 17:25:02 +0800</pubDate><description><![CDATA[Python的时间管理模块中除了time模块外还有非常好用的datetime模块，但不得不说的是有一点非常令人困扰，因为在datetime模块中有一个time对象，而time模块本身还有一个函数叫time()。其实Datetime比time高级了不少，可以直接理解为datetime是基于time进行了封装，提供了更多实用的函数。
datetime模块定义了下面这几个类：

**date：**表示日...]]></description><category></category></item><item><title><![CDATA[python之time模块]]></title><link>https://blog.csdn.net/itanders/article/details/88720573</link><guid>https://blog.csdn.net/itanders/article/details/88720573</guid><author>itanders</author><pubDate>Thu, 21 Mar 2019 17:23:04 +0800</pubDate><description><![CDATA[在编程中经常需要花费大量的精力来处理日期和时间。在Python有许多关于日期时间的内置库可以帮助我们减轻不少处理时间的工作，所以这次先从time模块介绍开始。

需要注意的是在time模块中的大多数函数是调用了所在平台C library的同名函数， 所以要特别注意有些函数是平台相关的，可能会在不同的平台有不同的效果。另外一点是，由于是基于Unix Timestamp，所以其所能表述的日期范围被限定...]]></description><category></category></item><item><title><![CDATA[关于Python鸭子类型]]></title><link>https://blog.csdn.net/itanders/article/details/88703604</link><guid>https://blog.csdn.net/itanders/article/details/88703604</guid><author>itanders</author><pubDate>Wed, 20 Mar 2019 23:43:40 +0800</pubDate><description><![CDATA[Python对实现多态性的要求很宽松，这就代表我们可以对不同对象调用同名的操作，甚至不用关注和谐对象的类型是什么，我们称这样的方式叫做鸭子类型。说的再通俗一点，就是如果某个对象的形状像鸭子，走的像鸭子，叫声像鸭子，那么就可以称这个对象是鸭子。当然这是通俗的解释，python中的鸭子类型也是这个道理，我们用实例解释一下。
下面我们定义了一个父类名为Quote，它含有两个who和says方法，以及定义...]]></description><category></category></item><item><title><![CDATA[@classmethod与@staticmethod区别]]></title><link>https://blog.csdn.net/itanders/article/details/88703556</link><guid>https://blog.csdn.net/itanders/article/details/88703556</guid><author>itanders</author><pubDate>Wed, 20 Mar 2019 23:41:00 +0800</pubDate><description><![CDATA[在Python中有3种方式定义类方法分别是常规方式、@classmethod修饰方式、@staticmethod修饰方式。
接下来分别对3种不同方式的定义举例说明。
普通方法: 其实就是需要操作一些实例独有的属性，是实例而不是类。第一个参数一般是隐式地将实例传递给self参数。
class People():
    def __init__(self, name, gender):
      ...]]></description><category></category></item><item><title><![CDATA[Python常用高阶函数]]></title><link>https://blog.csdn.net/itanders/article/details/88703541</link><guid>https://blog.csdn.net/itanders/article/details/88703541</guid><author>itanders</author><pubDate>Wed, 20 Mar 2019 23:39:42 +0800</pubDate><description><![CDATA[高阶函数是在Python中一个非常有用的功能函数，所谓高阶函数就是一个函数可以用来接收另一个函数作为参数，这样的函数叫做高阶函数。
为了便于理解，我们从实际例子来看看函数当做参数被传递到另个函数是什么样的。我们把abs()函数赋值给了f变量，接下来你就可以像使用abs()函数本身那样使用f变量了，区别只是换了个名字而已。
# 将求绝对值的abs函数赋值给f变量
f = abs
# f变量等同于ab...]]></description><category></category></item><item><title><![CDATA[理解Python中is 与 == 的区别]]></title><link>https://blog.csdn.net/itanders/article/details/88703515</link><guid>https://blog.csdn.net/itanders/article/details/88703515</guid><author>itanders</author><pubDate>Wed, 20 Mar 2019 23:38:14 +0800</pubDate><description><![CDATA[在Python中，有一个问题会被经常问到，那就是运算符is与==有什么区别?
很多人都知道他们都是比较两个对象是否相等，说起来都是比较对象，但是分不清什么时候用哪个，其实非常容易区分只要记住一点。

==是比较运算符，它比较的是两个对象中的值是否是相等的。而is是同一性运算符，比较的是两个对象的id值是否相等或者说比较的是对象的内存空间地址是否相等。

为了更好更深刻的理解，我们还是从几个例子出发...]]></description><category></category></item><item><title><![CDATA[numpy.where的用法]]></title><link>https://blog.csdn.net/itanders/article/details/88388532</link><guid>https://blog.csdn.net/itanders/article/details/88388532</guid><author>itanders</author><pubDate>Mon, 11 Mar 2019 09:55:56 +0800</pubDate><description><![CDATA[在用Python处理大量数据时，Python的数据科学库极为有用，这里要提到的就是Numpy库。在Numpy库里有个where函数，它是Python中三元表达式 x if condition else y的另一种版本。为了更好的理解numpy.where函数，我们来看几个where函数的使用例子。
传统三元表达式
有种情况，假设我们有xarr和yarr两个NumPy数组，还有一个cond的包含布尔...]]></description><category></category></item><item><title><![CDATA[Python标准库itertools模块]]></title><link>https://blog.csdn.net/itanders/article/details/88388518</link><guid>https://blog.csdn.net/itanders/article/details/88388518</guid><author>itanders</author><pubDate>Mon, 11 Mar 2019 09:55:11 +0800</pubDate><description><![CDATA[我们知道，迭代器在Python中是一种非常高效又好用的数据结构，迭代器的特点是可以做到惰性求值**(lazy evaluation的概念)** ，什么意思呢？就是只有当迭代到某个值的时候它才会被计算产生，比如要遍历一个大文件或者庞大的数据集时，使用传统的遍历就需要将它们一次性全部储存在内存中，而使用迭代器显而易见的好处则是每次只从对象中读取一条数据，不会造成内存的过大开销。
itertools中的...]]></description><category></category></item></channel></rss>