<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[chenlan_Cynthia的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/chenlan_Cynthia</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; chenlan_Cynthia]]></copyright><item><title><![CDATA[连接数据库]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/112767413</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/112767413</guid><author>chenlan_Cynthia</author><pubDate>Mon, 18 Jan 2021 11:11:26 +0800</pubDate><description><![CDATA[import pymysql
import pandas as pd


def get_mysql_data(sql):
    """
    提取mysql中的数据并返回成dataframe
    参数只需要sql语句

    """
    conn = pymysql.connect(
        host='*********',
        user='******',
        password='*********',
        db='*********',
  ]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap6:数据编码和处理]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106916995</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106916995</guid><author>chenlan_Cynthia</author><pubDate>Tue, 23 Jun 2020 11:26:03 +0800</pubDate><description><![CDATA[1.读写CSV数据
import csv
with open('stocks.csv') as f:
    f_csv = csv.reader(f)
    headers = next(f_csv)
    for row in f_csv:
        # Process row
        ...

2.读写JSON数据
import json
json_str = json.dumps(data)

3.解析简单的XML数据
from urllib.request import urlo]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap5:文件与IO]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106585401</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106585401</guid><author>chenlan_Cynthia</author><pubDate>Sat, 06 Jun 2020 17:37:25 +0800</pubDate><description><![CDATA[1.读写文本数据
# 使用带有 rt 模式的 open() 函数读取文本文件
# Read the entire file as a single string
with open('somefile.txt', 'rt') as f:
    data = f.read()

# Iterate over the lines of the file
with open('somefile.txt', 'rt') as f:
    for line in f:
        # process line]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap4:迭代器与生成器]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106578741</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106578741</guid><author>chenlan_Cynthia</author><pubDate>Sat, 06 Jun 2020 11:46:01 +0800</pubDate><description><![CDATA[1.

]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap3:数字日期和时间]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106565408</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106565408</guid><author>chenlan_Cynthia</author><pubDate>Fri, 05 Jun 2020 21:38:24 +0800</pubDate><description><![CDATA[1.数字的四舍五入 —— round(value, ndigits)
2.执行精确的浮点数运算
# 想更加精确(并能容忍一定的性能损耗) ——  decimal 模块
from decimal import Decimal
# decimal 模块的一个主要特征是允许你控制计算的每一方面，包括数字位数和四舍五入运算
a = Decimal('4.2')
b = Decimal('2.1')

3.数字的格式化输出
# 格式化输出单个数字的时候，可以使用内置的 format() 函数
x = 1234.567]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap2:字符串和文本]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106544963</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106544963</guid><author>chenlan_Cynthia</author><pubDate>Thu, 04 Jun 2020 20:48:57 +0800</pubDate><description><![CDATA[1.使用多个界定符分割字符串 —— re.split()
import re
# re.split()为分隔符指定多个正则模式

line = 'asdf fjdk; afed, fjek,asdf, foo'
re.split(r'[;,\s]\s*', line)
# ['asdf', 'fjdk', 'afed', 'fjek', 'asdf', 'foo']

# 需要特别注意的是正则表达式中是否包含一个括号捕获分组。 如果使用了捕获分组，那么被匹配的文本也将出现在结果列表中
fields = re]]></description><category></category></item><item><title><![CDATA[Python3-Cookbook-Study Notes chap1:数据结构和算法]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106540035</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106540035</guid><author>chenlan_Cynthia</author><pubDate>Thu, 04 Jun 2020 13:55:08 +0800</pubDate><description><![CDATA[1.数据结构的集合操作模块 —— collections
2.解压可迭代对象赋值给多个变量 —— 使用星号表达式
# 剔除最高最低分，统计平均分
def drop_first_last(grades):
	first,*middle,last = grades  # middle是一个列表类型变量
	return avg(middle)

3.字符串分割 —— line.split(’:’)
保留有限历史记录 —— collections.deque
# 在多行上面做简单的文本匹配， 并返回匹配所在行的最后]]></description><category></category></item><item><title><![CDATA[python 技巧学习-2020.06]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106531869</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/106531869</guid><author>chenlan_Cynthia</author><pubDate>Wed, 03 Jun 2020 20:44:51 +0800</pubDate><description><![CDATA[1.字符串清洗
df.translate(character_map)
# unicodedata 包：combining()函数

2.对迭代器进行切片
import itertools
s = itertools.islice(range(50),10,20)


]]></description><category></category></item><item><title><![CDATA[数据分析学习-数据清洗7步法]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/105374008</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/105374008</guid><author>chenlan_Cynthia</author><pubDate>Tue, 07 Apr 2020 21:39:00 +0800</pubDate><description><![CDATA[Step1 : read csv
data_raw = pd.read_csv('../input/titanicdataset-traincsv/train.csv')
data_raw

Step2 : preview data
data_raw.info()
data_raw.describe(include='all')

Step3: check null value for every...]]></description><category></category></item><item><title><![CDATA[python-Pandas_Study Record]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/105373773</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/105373773</guid><author>chenlan_Cynthia</author><pubDate>Tue, 07 Apr 2020 21:16:16 +0800</pubDate><description><![CDATA[2020-04-07
读取时抽取1%
import pandas as pd
import numpy as np

df = pd.read_csv("big_data.csv",  # 使用skiprows参数
skiprows = lambda x:x&gt;0 and    # x&gt;0保证首行选入
np.random.rand() &gt; 0.01)


...]]></description><category></category></item><item><title><![CDATA[玩转numpy]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/103727440</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/103727440</guid><author>chenlan_Cynthia</author><pubDate>Fri, 27 Dec 2019 10:59:55 +0800</pubDate><description><![CDATA[numpy - 通用
1. 忽略所有numpy警告
defaults = np.seterr(all="ignore")

numpy - 数组
1. 创建数组
# 创建一个10*10的0数组
Z = np.zeros((10,10))
print(Z)

# 长度为10的0数组，第4个值为1
Z = np.zeros(10)
Z[3] = 1

# 创建一个从0到8的3*3数组
Z = np.a...]]></description><category></category></item><item><title><![CDATA[pandas DataFrame 数据筛选]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/103460708</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/103460708</guid><author>chenlan_Cynthia</author><pubDate>Mon, 09 Dec 2019 17:11:09 +0800</pubDate><description><![CDATA[数值筛选
单条件筛选
# 筛选B列大于0的数据
df[df['B'] &gt; 0]

多条件筛选
# 筛选B列大于0且C列小于1的数据
df[(df['B'] &gt; 0) &amp; (df['C'] &lt; 1)]

# 筛选B列大于0或C列小于1的数据
df[(df['B'] &gt; 0) | (df['C'] &lt; 1)]

# 选择某列等于多个数值或者字符串
df[df['B...]]></description><category></category></item><item><title><![CDATA[数据分析面试笔试资料汇总]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/89381833</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/89381833</guid><author>chenlan_Cynthia</author><pubDate>Thu, 18 Apr 2019 16:28:40 +0800</pubDate><description><![CDATA[网易-数据分析师笔试
1、一堆石子，共80颗、甲乙轮流取，每次只能取2、4、6颗，最后取的人赢，甲先取，则谁赢？
Ans：乙必赢。只需要保证最后剩8枚就胜了，要保证最后剩8枚，则必须要保证每一个回合内取的数是一个可控的固定数，显然这个数字是8，所以只需要保证第一次取完后，剩下的数字是8的倍数，就一定能胜。80除以8正好除尽，故而，无论甲去的是多少，乙都能保证每回合取的数为8，最后取完的人一定是乙。...]]></description><category></category></item><item><title><![CDATA[记录一下我的数据分析师养成之路]]></title><link>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/89379158</link><guid>https://blog.youkuaiyun.com/chenlan_Cynthia/article/details/89379158</guid><author>chenlan_Cynthia</author><pubDate>Thu, 18 Apr 2019 15:04:41 +0800</pubDate><description><![CDATA[学习书目


《统计学》
很好的统计学入门书籍，对统计学的基础概念介绍的很详细，浅显易懂大概5-8个小时就可以快速看完。


《R语言实战》
本科上学用R语言的时候参考过一点这本书，重新系统看了一遍还是很不错的书。


《SQL必知必会》



...]]></description><category></category></item></channel></rss>