随笔分类 -  Python

摘要:#!/usr/bin/python import random import numpy import matplotlib.pyplot as plt import pickle from outlier_cleaner import outlierCleaner from sklearn.lin 阅读全文
posted @ 2020-07-16 23:25 Zhentiw 阅读(293) 评论(0) 推荐(0) 编辑
摘要:Predicting Student Admissions with Neural Networks In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of 阅读全文
posted @ 2020-06-22 19:42 Zhentiw 阅读(315) 评论(0) 推荐(0) 编辑
摘要:PyPi vs. Test PyPi Note that pypi.org and test.pypy.org are two different websites. You'll need to register separately at each website. If you only re 阅读全文
posted @ 2020-06-04 14:41 Zhentiw 阅读(154) 评论(0) 推荐(0) 编辑
摘要:In this next section, you'll convert the Distributions code into a Python package. A package is a collection of Python modules. Although the previous 阅读全文
posted @ 2020-06-03 14:20 Zhentiw 阅读(218) 评论(0) 推荐(0) 编辑
摘要:def my_decorator(func): def wrapper(): print("Something is happening before the function is called.") func() print("Something is happening after the f 阅读全文
posted @ 2020-05-30 19:25 Zhentiw 阅读(111) 评论(0) 推荐(0) 编辑
摘要:The same as Javascript: // Javascript function sayHello(name) { return `Hello ${name}` } //python def say_hello(name): return f"Hello {name}" 阅读全文
posted @ 2020-05-30 19:23 Zhentiw 阅读(117) 评论(0) 推荐(0) 编辑
摘要:class Clothing: def __init__(self, color, size, style, price): self.color = color self.size = size self.style = style self.price = price def change_pr 阅读全文
posted @ 2020-05-30 00:53 Zhentiw 阅读(164) 评论(0) 推荐(0) 编辑
摘要:Thinking how to add tow Guessin object together? It is similar idea to Functional programming, Data type. import math import matplotlib.pyplot as plt 阅读全文
posted @ 2020-05-28 01:48 Zhentiw 阅读(288) 评论(0) 推荐(0) 编辑
摘要:import math import matplotlib.pyplot as plt class Gaussian(): """ Gaussian distribution class for calculating and visualizing a Gaussian distribution. 阅读全文
posted @ 2020-05-28 01:40 Zhentiw 阅读(337) 评论(0) 推荐(0) 编辑
摘要:import time import pandas as pd import numpy as np with open('books_published_last_two_years.txt') as f: recent_books = f.read().split('\n') with open 阅读全文
posted @ 2020-05-23 17:09 Zhentiw 阅读(389) 评论(0) 推荐(0) 编辑
摘要:Using the open function, and the as and with keywords, we'll open up and read from a file. At the end of this lesson, you will be able to loop through 阅读全文
posted @ 2020-05-13 18:57 Zhentiw 阅读(159) 评论(0) 推荐(0) 编辑
摘要:In this lesson, you will learn how to statically type variables in Python 3.6 Static typing can help you avoid errors when consumers of your variables 阅读全文
posted @ 2018-05-21 02:15 Zhentiw 阅读(249) 评论(0) 推荐(0) 编辑
摘要:How to install Flask Use Flask to create a minimal website Build routes in Flask to respond to website endpoints Use Variable Rules to pass parts of t 阅读全文
posted @ 2018-04-30 15:58 Zhentiw 阅读(199) 评论(0) 推荐(0) 编辑
摘要:In this lesson, you will learn how to implement pytest fixtures. Many unit tests have the same resource requirements. For example, an instantiated obj 阅读全文
posted @ 2018-02-22 22:04 Zhentiw 阅读(349) 评论(0) 推荐(0) 编辑
摘要:In this lesson you will create a new project with a virtual environment and write your first unit test with pytest. In doing so, you will learn: insta 阅读全文
posted @ 2018-02-05 19:12 Zhentiw 阅读(342) 评论(0) 推荐(0) 编辑
摘要:Let's you have $10000, and you inverst 4 stocks. ['SPY', 'IBM', 'XOM', 'GOOG']. The allocation is [0.4, 0.4, 0.1, 0.1] separately. The way to calculat 阅读全文
posted @ 2018-01-17 20:02 Zhentiw 阅读(314) 评论(0) 推荐(0) 编辑
摘要:Sploe = 2: means that SPY move up 1, ABC move up 2 Correlation: how close those dots close to the line. 阅读全文
posted @ 2018-01-09 02:57 Zhentiw 阅读(697) 评论(0) 推荐(0) 编辑
摘要:In this lesson, you will be introduced to Python generators. You will see how a generator can replace a common function and learn the benefits of doin 阅读全文
posted @ 2018-01-08 23:34 Zhentiw 阅读(238) 评论(0) 推荐(0) 编辑
摘要:A histogram is an accurate representation of the distribution of numerical data. Y axis is the occurances, X axis is the % of daily return. There are 阅读全文
posted @ 2017-12-28 21:34 Zhentiw 阅读(893) 评论(0) 推荐(0) 编辑
摘要:In the store marketing, for many reason, one stock's data can be incomplete: We can use 'forward fill' and 'backward fill' to fill the gap: forward fi 阅读全文
posted @ 2017-12-22 02:41 Zhentiw 阅读(3216) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示