我的代码-normalize
# coding: utf-8
# In[13]:
import pandas as pd
import numpy as np
import scipy as sp
from os import listdir
from os.path import isfile, join
from . import cleaning
mypath = r"D:\Users\sgg91044\Desktop\auto_data"
for j in range(20000):
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
for file in onlyfiles:
*
*
*
time.sleep(10)
print("no files in the folder now, will check again")
j+1
#data=pd.read_csv(mypath + "\\" + file)
data=data.iloc[:,1:]
#data = data[data.ooc == 'N']
#data = data[data.oos == 'N']
data.drop(['ooc','oos'],axis=1,inplace=True)
data.drop(["waferid","Step","finishtime","parametername"],axis=1,inplace=True)
data.columns = ["eqpid","chamber","lot","wafer","param_name","recipe","data"]
pivoted = data.pivot_table(index=['eqpid','chamber','lot','wafer','recipe'],columns="param_name",values="data",aggfunc=np.sum)
pivoted.reset_index(inplace=True)
columns=["eqpid","chamber","lot","wafer","recipe","ETCM_PHA4","ETCM_PHB4","ETCM_PHC4","HELK_MAX.","HELK_MEAN","HELK_SD","LOWERCHM_PRESS","PBK4","RR13_MAX.","RR13_MEAN","RR23_MAX.","RR23_MEAN","THR3_MAX.","THR3_MAX._DIFF","THR3_MEAN","THR3_MEAN_DIFF","THR3_MEAN_SLOPE","THR3_SD"]
final = pd.DataFrame(columns = columns)
final = final.merge(pivoted,how="right").reindex_axis(columns, axis=1)
final=final.drop(columns=["eqpid","chamber","lot","wafer","recipe"])
final.to_csv(mypath + "\\" + "pivoted1_" + file)
# In[14]:
# numpy and pandas for data manipulation
import numpy as np
import pandas as pd
# sklearn preprocessing for dealing with categorical variables
from sklearn.preprocessing import LabelEncoder
# File system manangement
import os
# Suppress warnings
import warnings
warnings.filterwarnings('ignore')
# matplotlib and seaborn for plotting
import matplotlib.pyplot as plt
import seaborn as sns
# In[15]:
app_test = pd.read_csv(r'D:\Users\sgg91044\Desktop\more_parameter\more_parameter_pivot.csv')
# In[16]:
# Function to calculate missing values by column# Funct
def missing_values_table(app_test):
# Total missing values
mis_val = app_test.isnull().sum()
# Percentage of missing values
mis_val_percent = 100 * app_test.isnull().sum() / len(app_test)
# Make a table with the results
mis_val_table = pd.concat([mis_val, mis_val_percent], axis=1)
# Rename the columns
mis_val_table_ren_columns = mis_val_table.rename(
columns = {0 : 'Missing Values', 1 : '% of Total Values'})
# Sort the table by percentage of missing descending
mis_val_table_ren_columns = mis_val_table_ren_columns[
mis_val_table_ren_columns.iloc[:,1] != 0].sort_values('% of Total Values', ascending=False).round(1)
# Print some summary information
print ("Your selected dataframe has " + str(app_test.shape[1]) + " columns.\n"
"There are " + str(mis_val_table_ren_columns.shape[0]) + " columns that have missing values.")
# Return the dataframe with missing information
return mis_val_table_ren_columns
# In[17]:
# Missing values statistics
missing_values = missing_values_table(app_test)
missing_values
# In[ ]:
#!/usr/bin/env python
# -*- coding: utf8 -*-
# author: klchang
# Use sklearn.preprocessing.normalize function to normalize data.
from __future__ import print_function
import numpy as np
from sklearn.preprocessing import normalize
x = np.array([1, 2, 3, 4], dtype='float32').reshape(1,-1)
print("Before normalization: ", x)
options = ['l1', 'l2', 'max']
for opt in options:
norm_x = normalize(x, norm=opt)
print("After %s normalization: " % opt.capitalize(), norm_x)
我的代码-normalize的更多相关文章
- Normalize.css 介绍与源码解读
开始 Normalize.css 是一个可定制的 CSS 文件,使浏览器呈现的所有元素,更一致和符合现代标准;是在现代浏览器环境下对于CSS reset的替代. 它正是针对只需要统一的元素样式.该项目 ...
- Normalize.css介绍,作用,使用方法
介绍 Normalize.css 是一个很小的CSS文件(V5.0.0版本大小8KB),但它在默认的HTML元素样式上提供了跨浏览器的高度一致性.相比于传统的CSS reset,Normalize.c ...
- get到的新技能
1.重拾选择器 (一)类选择器与id选择器的区别 W3C标准这样规定的,在同一个页面内,不允许有相同名字的id对象出现,但是允许相同名字的class. 这样,一般网站分为头,体,脚部分,因为考虑到它们 ...
- vue vuex vue-rouert后台项目——权限路由(超详细简单版)
项目地址:vue-simple-template共三个角色:adan barbara carrie 密码全是:123456 adan 拥有 最高权限A 他可以看到 red , yellow 和 blu ...
- css进阶 07-CSS面试题
07-CSS面试题 #常见问题 #你是如何理解 HTML 语义化的? 语义化:指对文本内容的结构化(内容语义化),选择合乎语义的标签(代码语义化). 举例:段落用 p,边栏用 aside,主要内容用 ...
- Normalize.css做了哪些事情--看代码
博主说:本博客文章来源包括转载,翻译,原创,且在文章内均有标明.鼓励原创,支持创作共享,请勿用于商业用途,转载请注明文章链接.本文链接:http://www.kein.pw/?p=80 /*! nor ...
- CSS3鼠标悬停图片上浮显示描述代码
效果:http://hovertree.com/texiao/css3/20/ 效果图: 代码如下: <!doctype html> <html lang="zh" ...
- Normalize.css的使用及下载
Normalize.css 只是一个很小的CSS文件,但它在默认的HTML元素样式上提供了跨浏览器的高度一致性.相比于传统的CSS reset,Normalize.css是一种现代的.为HTML5准备 ...
- 20个编写现代 CSS 代码的建议
明白何谓Margin Collapse 不同于其他很多属性,盒模型中垂直方向上的Margin会在相遇时发生崩塌,也就是说当某个元素的底部Margin与另一个元素的顶部Margin相邻时,只有二者中的较 ...
随机推荐
- python之路-----MySql操作二
一.主键 1.每个 表只有一个主键 2.每个主键可以由多个列组成.(如果主键由多个组成,只要有一行列值不等即可) CREATE TABLE NAME ( id INT auto_increment, ...
- Python爬虫入门之Cookie的使用
本节我们一起来看一下Cookie的使用. 为什么要使用Cookie呢? Cookie,指某些网站为了辨别用户身份.进行session跟踪而储存在用户本地终端上的数据(通常经过加密) 比如说有些网站需要 ...
- apache-jmeter 使用记录
1.显示中文 找到jmeter下的bin目录,打开jmeter.properties 文件将 #language=en 修改为 language=zh_CN以后打开就是中文界面了 2.jmeter报错 ...
- rabbitmq 日志存储路径
Linux 下/var /log/rabbitmq/ windows下C:\Users\Administrator\AppData\Roaming\RabbitMQ\log
- 洛谷P2886 [USACO07NOV]牛继电器Cow Relays
题意很简单,给一张图,把基本的求起点到终点最短路改成求经过k条边的最短路. 求最短路常用的算法是dijkstra,SPFA,还有floyd. 考虑floyd的过程: c[i][j]=min(c[i][ ...
- vue 路由(1)
路由的使用 (5步) 1.首先安装路由 npm install vue-router2.引入 vue-router import VueRouter from 'vue-router' 3.使用 ...
- Cocos2dx 代码中包含中文导致编译错误的问题解决方法
从网上下载一个cocos2dx的源码,是IOS版本的,我将其迁移到windows 7下 ,用VS2010编译,出现一堆的C2001错误: 1>d:\cocos2d-x-2.2.6\mygame\ ...
- Spring Factory
BeanFactory和FactoryBean均为接口: BeanFactory为IOC容器的创建提供了一个最底层的规范,主要方法包括contains(bean), getBean(class, be ...
- error: ‘module’ object has no attribute ‘_rebuild_tensor_v2’
import torch._utils try: torch._utils._rebuild_tensor_v2 except AttributeError: def _rebuild_tensor_ ...
- spyder常用功能
最近和同学讨论到spyder的使用技巧,所以就结合之前在网上看到网友的总结( https://blog.csdn.net/peiwang245/article/details/78528098)和自己 ...