自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 dataframe排序

count_df=count_df.sort_values(by='count',ascending=False)

2020-12-15 14:04:46 194 1

原创 将txt读取 并转换为dataframe

f = open("interest.txt","r",encoding='utf-8') #设置文件对象result=[]for line in f.readlines():#readlines以列表输出文件内容 line=line.strip().split("\t") result.append(line)f.close() #将文件关闭result=pd.DataFrame(result).dropna(axis=0)...

2020-12-15 13:32:41 4094

原创 将dataframe转为list

要处理的dataframe>>>corr_result基金代码 159801.0 159804.0 159805.0 ... 515960.0 515980.0 515990.0基金代码 ... 159801.0 1.000000 0.865664 0.861470 ... 0.713277 0.939222 0.754

2020-12-10 20:24:37 1336

原创 SKLEARN NEAREST NEIGHBOR & KNeighborsClassifier

ALGORITHM-1NNfrom sklearn.neighbors import NearestNeighborsimport numpy as npX = np.array([[-1, -1], [1, 1], [-3, -2], [1, 1], [2, 1], [3, 2]])nbrs = NearestNeighbors(n_neighbors=2, algorithm='ball_tree').fit(X)distances, indices = nbrs.kneighbors(X)

2020-12-10 11:29:58 180

原创 判断dataframe中的值是否为空

pd.isna(data.iloc[j, i])空值也可能是np.nan matn.nan

2020-12-08 12:10:42 2972

原创 使用APPEND向list添加值并排序

first_day.append(data.index[j])

2020-12-08 12:09:13 404

原创 根据multiindex生成面板数据

data=data.set_index(['日期','基金代码'])['单位净值']data=data.unstack()

2020-12-08 12:07:05 133

原创 读取csv时将日期设为timestamp

data = pd.read_csv('etf18012009.csv',parse_dates = ['日期'])

2020-12-08 12:02:52 540

原创 第五章课后题

PRAC 1// prac1.cpp#include<iostream>int small;int large;int result;int i;int main(){ using namespace std; cout << "Enter a samll number: "; cin >> small; cout << "Enter a large number: "; cin >> large; for (i=sma

2020-12-08 12:00:33 331

原创 第6章 分支语句和逻辑运算符

6.1 if语句程序清单6.1 if.cpp// if.cpp -- using the if statement#include<iostream>int main(){ using std::cin; using std::cout; using std::endl; char ch; int space = 0; int total = 0; cin.get(ch); while (ch!='.') //quit at end of sentence {

2020-12-08 12:00:22 129

原创 第四章 课后题

Prac 1// prac1.cpp#include<iostream>struct aaa{ char first_name[20]; char last_name[20]; char grade; int Age; } ; int main() { using namespace std; aaa * b = new aaa; cout << "What is your first name?"; cin.get(b->first_n

2020-07-11 11:46:12 207

原创 第5章 循环和关系表达式

5.1 for循环程序清单5.1 forloop.cpp// forloop.cpp -- introducing the for loop#include<iostream>int main(){ using namespace std; int i; // create a counter for (i = 0; i < 5; i++) cout << "C++ knows loops.\n"; cout << "C++ knows

2020-07-11 11:44:11 257

原创 Chapter3 课后题

PRAC 1// prac1.cpp#include<iostream>const int trans = 100;int main(){ using namespace std; cout << "Enter your height:___\b\b\b"; int height; cin >> height; double theight = double(height)/ trans; cout << "Your height is

2020-07-04 19:28:02 101

原创 第四章 复合类型

4.1 数组数组可以存储60个int类型的值、12个short值或365个float值。要创建数组,可使用声明语句。数组声明应指出以下三点:存储在每个元素中的值的类型;数组名;数组中的元素数;short months[12]; // creats array of 12 short 程序清单 4.1 arrayone.cpp// arrayone.cpp -- small arrays fo integers#include<iostream>int main(){

2020-07-04 19:27:37 192

原创 第三章 数据处理

3.1 简单变量3.1.1 变量名在名称中只能使用字母字符、数字和下划线名称的第一个字符不能是数字区分大小写不能使用关键字int _Mystar3; //valid but reserved --starts with underscoreint __foold; // valid but reserved --starts with two underscore 3.1.2 整型3.1.3 整形short、int、long和long longshort至少16位int至少和sho

2020-06-27 19:38:53 482

原创 Chapter2 练习

PRAC 1//prac1#include<iostream>int main(){ using namespace std; cout << "My name is Bing." << endl; cout << "I live in Chengdu" << endl; return 0; } My name is Bing.I live in ChengduPRAC 2// prac2.cpp#include&

2020-06-26 18:10:41 67

原创 C++ Primer Plus 第2章 开始学习C++

2.1 进入C++程序清单2.1 myfirst.cpp// my first.cpp -- display a message#include<iostream> // a PREPROCESSOR directiveint main() // function header{ //start of function body using namespace std; //make definitions vi

2020-06-26 17:38:51 290

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除