我的代码-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相邻时,只有二者中的较 ...
随机推荐
- selenium自动化实例: 多层框架中关于iframe的定位,以及select下拉框选择
对于一个自动化的初学者来说会很常见的遇到元素明明存在却始终定位不到, 从而导致脚本报错,当然定位不到元素的原因很多, 其中一种就是多层框架iframe导致的 下方截图示意: 下方为写脚本时候的示例并其 ...
- spoj Ae2b
题解: 设最后为x1+t1k+t2n,y1+t3k+t4n 显然t1,t4或t2,t3同余(mod 2) 然后exgcd一下 代码: #include<bits/stdc++.h> #de ...
- aspectj编程简介
现在java生态中spring大行其道,一般使用aspectj进行切面编程使用注解方式实现,比较少使用原生的aspectj编程,网上的资料也比较少.最近工作中需要封装redisson客户端提供统一的r ...
- 关于STL的map的注意事项
关于map是什么,这里就不多叙述了. 直接正题,常用的map插入操作有三种方法:通过pair<key_type,value_type>.通过value_type插入数据.还有一种类似于数组 ...
- java基础1(二)
Bean的xml配置 1.bean的初始化方式 三种方式: 默认构造器,静态工厂初始化(了解)和实例工厂初始化(了解) 2.springbean的作用域 Bean默认作用域是单实例的 可以设置非单实例 ...
- css书写规范以及如何写出赏心悦目的代码
css书写规范: 1. 编码统一为utf-8;2. 协作开发及分工: i根据各个模块, 同时根据页面相似程序, 事先写好大体框架文件,同时根据页面相似程序,事先写好大体框架文件.共用css文件base ...
- 递归----Python
#递归不仅仅是学习python中会遇到的一些问题,在学习每一个语言的过程中都会遇到递归.使用递归可以让复杂的循环变得简单. 递归:程序调用自身的行为 1.写一个数的阶乘 #递归 def factor( ...
- 踩坑学习python自动化测试第二天!
class put_out(object): def Helloword(str): print(str) Hello,Inder,Pist ="", [],{} word= st ...
- vue-resource 和 axios的区别
vue-resource Vue.js是数据驱动的,这使得我们并不需要直接操作DOM,如果我们不需要使用jQuery的DOM选择器,就没有必要引入jQuery.vue-resource是Vue.js的 ...
- Spring Factory
BeanFactory和FactoryBean均为接口: BeanFactory为IOC容器的创建提供了一个最底层的规范,主要方法包括contains(bean), getBean(class, be ...