tag 标签: import经管大学堂:名校名师名课

相关帖子

版块 作者 回复/查看 最后发表
stata中运行为什么会出现invalid name? attachment Stata专版 caozhiqiang1215 2013-8-27 11 62928 一觉睡到小时候lk 2023-11-8 09:25:41
导入csv出错,Unable to sample external file, no data in first 5 records. attachment SAS专版 Imasasor 2013-7-24 14 9431 gggwww 2021-8-5 14:38:03
sas 导入csv格式的数据时出问题了,请高手指点 attachment SAS专版 klaudlit 2013-3-17 17 17126 FancyWu 2018-4-5 18:05:11
导入excel格式数据,并保持非科学计数法 attachment Stata专版 蓝色 2013-8-12 13 14280 lianxungong 2018-3-18 12:26:46
为什么select import type里面没有选项? SAS专版 Ursaminor 2013-9-5 1 1533 bakoll 2015-2-8 17:59:09
CSV file import到 sas时出现问题 SAS专版 一眼瞬间 2013-9-7 1 1300 bakoll 2015-2-8 17:54:43
Proc import 变量格式 SAS专版 edwardzxf 2013-7-25 8 14676 davidcai1221 2015-1-20 01:51:19
进口替代工业化战略的反思 by HENRYJ. BRUTON attachment 世界经济与国际贸易 青春的奋斗 2013-9-7 0 1125 青春的奋斗 2013-9-7 20:57:45
关于import 问题 怪异现象 attach_img SAS专版 mkj_2009 2013-8-23 1 1329 hkhl237 2013-8-26 10:35:32
Import file的时候说我格式不对,没法import,请教解决方法 SAS专版 一眼瞬间 2013-8-21 2 1645 tangliang0905 2013-8-22 01:29:51
Export-Import Theory Practices and Procedures attach_img 世界经济与国际贸易 ccfenghuang 2013-7-12 0 2539 ccfenghuang 2013-7-12 20:53:02
請問怎麼import一個有密碼保護的excel文件 SAS专版 vieri32 2013-7-10 3 4016 playmore 2013-7-11 11:35:14
在import 过程中用dbdsopts巧妙选择读入excel文件的指定行 attach_img SAS专版 webgu 2013-3-19 5 4597 darrenda 2013-6-9 09:27:21
悬赏 求大神解答下import过程的问题 - [!reward_solved!] SAS专版 菜小锐 2013-6-7 2 1037 菜小锐 2013-6-7 12:46:15
悬赏 求文:Global trade in ornamental fish from an Australian perspective: The case - [!reward_solved!] attachment 求助成功区 daodaory 2013-6-6 1 1016 liu-katie 2013-6-6 13:14:06
请教高手,import数据前,如何定义var length? SAS专版 liulubucm 2013-5-15 7 3994 liulubucm 2013-5-17 10:29:22
悬赏 原始数据转化成panel data - [!reward_solved!] attach_img SAS专版 zhjkbant 2013-4-8 14 4500 zhjkbant 2013-4-10 10:48:23
悬赏 如果批量将excel 2007变成excel 2000,如何导入一个excel的多个sheet - [!reward_solved!] SAS专版 Imasasor 2013-2-25 24 6143 zhentao 2013-3-4 10:23:42
读数据出问题请大牛解答! MATLAB等数学软件专版 广君 2013-1-14 0 2690 广君 2013-1-14 19:13:25

相关日志

分享 p2_对某个文件夹中的文件统一处理
xulimei1986 2016-4-1 15:35
import os path =r'E:\CRM\phone\call' path2= r'E:\CRM\phone\result' for root,dirs,files in os.walk(path): for fn in files: #print fn name=fn.split('.') wroute1 = r'%s'%path+'\\'+fn wroute2 = r'%s'%path2+'\\'+name+'jieguo.txt' file1 = open(wroute1,'r') file2 = open(wroute2,'w+') for k in file1.readlines(): if 'com' in k : list1 = k.strip().split('\t') urs = list1 #print urs call_1 = list1 if call_1.find("打DM电话")!=-1: file2.write('%s\t%s\n'%(urs,call_1)) file2.close() ''' name_list = for name in name_list: wroute1 = r'E:\CRM\phone\call\%s.txt'%name wroute2 = r'E:\CRM\phone\call\%s'%name+'jieguo.txt' #print wroute1,wroute2 file1 = open(wroute1,'r') file2 = open(wroute2,'w+') for k in file1.readlines(): if 'com' in k : list1 = k.strip().split('\t') urs = list1 #print urs call_1 = list1 if call_1.find("打DM电话")!=-1: file2.write('%s\t%s\n'%(urs,call_1)) file2.close() '''
0 个评论
分享 p1_日期处理函数
xulimei1986 2016-3-28 16:39
__author__ = 'g6591' # -*- coding: utf-8 -*- import datetime,time #定义日期的格式,可以改为自己需要的 format_date = "%Y-%m-%d" format_datetime = "%Y-%m-%d %H:%M:%S" def getCurrentDate(): '''获取当前日期:2016-06-26这样的日期字符串''' return time.strftime(format_date,time.localtime(time.time())) def getCurrentDateTime(): '''获取当前时间:2016-06-26 13:34:25''' return time.strftime(format_datetime,time.localtime(time.time())) def getCurrentHour(): '''获取当前时间的小时数,比如如果当前是下午16时,则返回16''' currentDatetime = getCurrentDateTime() return currentDatetime def getDateToNumber(date1): ''' 将日期字符串中的减号及冒号去掉 输入:2016-02-26,返回:20160226 输入:2016-02-26 13:46:30,返回:20160226131630 ''' return date1.replace("-","").replace(":","").replace("","") def judgeDateFormat(datestr): ''' 判断日期的格式,如果是"%Y-%m-%d"则返回1,如果是"%Y-%m-%d %H:%M:%S"则返回2,否则返回0 参数datestr:日期字符串 ''' try: datetime.datetime.strptime(datestr,format_date) return 1 except: pass try: datetime.datetime.strptime(datestr,format_datetime) return 2 except: pass return 0 def getDateElements(sdate): ''' 输入日期字符串,返回一个结构体组,包含了日期的各个分量 输入:2016-02-26 或者2016-02-26 13:40:50 返回:time.struct_time(tm_year=2016,tm_month=2,tm_mday=26,tm_hour=13,tm_min=40,tm_sec=50) ''' dformat = "" if judgeDateFormat(sdate)==0: return None if judgeDateFormat(sdate)==1: dformat = format_date if judgeDateFormat(sdate)==2: dformat = format_datetime sdate = time.strptime(sdate,dformat) return sdate def minusTwoDate(date1,date2): ''' 将两个日期相减,获取相减后的datetime.timedelta对象 对结果可以直接访问其属性days、seconds、microseconds ''' if judgeDateFormat(date1)==0 or judgeDateFormat(date2)==0: return None d1Elements = getDateElements(date1) d2Elements = getDateElements(date2) if not d1Elements or not d2Elements: return None d1 = datetime.datetime(d1Elements.tm_year,d1Elements.tm_mon,d1Elements.tm_mday,d1Elements.tm_hour,d1Elements.tm_min,d1Elements.tm_sec) d2 = datetime.datetime(d2Elements.tm_year,d2Elements.tm_mon,d2Elements.tm_mday,d2Elements.tm_hour,d2Elements.tm_min,d2Elements.tm_sec) return d2-d1 def dateAddIndays(date1,addcount): ''' 日期加上或减去一个数字,返回一个新的日期 参数date1:要计算的日期 参数addcount:要增加或者减去的数字,可以为1、2、3、-1、-2、-3,负数表示相减 ''' try: addtime = datetime.timedelta(days=int(addcount)) d1Elements = getDateElements(date1) d1 = datetime.datetime(d1Elements.tm_year,d1Elements.tm_mon,d1Elements.tm_mday) datenew = d1+addtime return datenew.strftime(format_date) except Exception as e: print e return None def is_leap_year(pyear): ''' 判断输入的年份是否是闰年 ''' try: datetime.datetime(pyear,2,29) return True except ValueError: return False def dateDiffInDays(date1,date2): ''' 获取两个日期相差的天数,如果date1大于date2,返回正数,否则返回负数 ''' minusObj = minusTwoDate(date1,date2) try: return minusObj.days except: return None def dateDiffInSeconds(date1,date2): ''' 获取两个日期相差的秒数 ''' minusObj = minusTwoDate(date1,date2) try: return minusObj.days*24*3600+minusObj.seconds except: return None def getWeekOfDate(pdate): ''' 获取日期对应的周,输入一个日期,返回一个周数字,范围是0~6、其中0代表周日 ''' pdateElements = getDateElements(pdate) weekday = int(pdateElements.tm_wday)+1 if weekday ==7 : weekday = 0 return weekday if __name__=="__main__": '''测试代码''' print getCurrentDate()
0 个评论
分享 Python——command
accumulation 2016-1-7 00:57
import os def dA(): os.system("python C:\\Users\SONY\A.py") def dB(): os.system("python C:\\Users\SONY\B.py") def dC(): os.system("python C:\\Users\SONY\C.py") #---------------------------------------------------------------- window = Tk() #设置能执行各个函数的Buttons stacy1 = Button(window, text = 'Trend', command = dA) stacy2 = Button(window, text = 'Piework Year', command = dB) stacy3 = Button(window, text = 'Piework Month', command = dC) stacy1.pack() stacy2.pack() stacy3.pack() window.mainloop()
个人分类: 金融工程|0 个评论
分享 IPython——xlrd
accumulation 2016-1-5 01:36
import xlrd #打开EXCEL文件 excel=xlrd.open_workbook( 'C:\\Users\SONY\Desktop\patents.xlsx' ) #获取第一个sheet sheet=excel.sheets() #打印第i行数据 print (sheet.row_values(i)) i=0,1,2... #打印第j列数据 print (sheet.col_values(j)) j=0,1,2...
个人分类: 金融工程|0 个评论
分享 Linear Equation
accumulation 2015-9-20 12:17
import scipy as sp import numpy as np A=sp.mat(' ') b=sp.mat(' ') print (A.I*b)
个人分类: 金融工程|0 个评论
分享 sas import
山久丰 2015-4-16 17:34
import 程序一般形式: proc import out=sas-data-set datafile=" 外部文件路径" dbms=data-type replace
个人分类: SAS|0 个评论
分享 TB
梦之殇 2015-1-28 19:56
# -*- coding:cp936 -*- import urllib2 import time,datetime import urllib import re import sys import json import cookielib import time import os from operator import itemgetter urllib.getproxies_registry = lambda:{} class NewBBS(): def __init__(self,name,url,minprice,maxprice): self.os_char='gb18030' self.dw={} html=self.getHtml(url) datalist=self.getdata(html) self.makedata(datalist,name,minprice,maxprice) def getHtml(self,url): page = urllib.urlopen(url) html = page.read() #print html return html def getdata(self,html): reg=r'"detail_url":"(.*?)","comment_url":"http:.*?","view_sales":".*?","view_price":"(\d+.\d+)","view_fee":"(\d+.\d+)","shopLink":"' imgre = re.compile(reg) imglist = re.findall(imgre,html) return imglist def makedata(self,datalist,name,minprice,maxprice): minprice=float(minprice) maxprice=float(maxprice) nowday=time.strftime('%Y%m%d',time.localtime(time.time())) #print datalist da={} w=open('taobao.txt','a+') for i in w: if i not in da: da =1 dt={} w1=open('data.txt','a+') for i in w1: if i not in dt: dt =1 dsort={} for i in datalist: #time.sleep(1) dataurl=i dataprice=float(i )+float(i ) dataurl=" http://item.taobao.com//item."+dataurl k=nowday+'\t'+name+'\t'+dataurl if k not in dsort: dsort =dataprice lsort=sorted(dsort.iteritems(), key=itemgetter(1), reverse=False) for j in lsort: k=j +'\t'+str(j ) if k not in dt: w1.write('%s\n'%(k)) if j maxprice and j minprice: #os.startfile('%s' %dataurl) #print dataurl if k not in da: w.write('%s\n'%(k)) while True: os_char='gb18030' w = open('taobao.txt','a+') w.write('--------------%s------------------\n'%(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))) w.close() nowday=time.strftime('%Y%m%d',time.localtime(time.time())) f=open('购买.txt','r') for i in f: name,minprice,maxprice=i.strip().split() name2=urllib.quote(name.decode(sys.stdin.encoding).encode('utf8')) #url=" http://s.taobao.com/search?q="+name2+"js=1stats_click=search_radio_all%253A1initiative_id=staobaoz_"+nowday url=" http://s.taobao.com/search?fs=1initiative_id=tbindexz_"+nowday+"tab=allq="+name2+"suggest=history_1source=suggestfilterFineness=1 " n=NewBBS(name,url,minprice,maxprice) print 'wait' time.sleep(3600)
0 个评论
分享 [网上转载]import导入excel出错,在64位Win7操作系统中安装Microsoft Access Engine的 ...
zelision 2014-10-30 09:06
用import导入excel文件出现数据接引擎没有注册类,无法导入,从网上搜了一个解决方案,试用了正好解决! 现在的Win7系统中安装的一般都是32位的Office,因为微软推荐使用32位的Office,兼容性更强,稳定性更好。在使用Access作为数据库的时候,C#操作Access,如果Access是accdb,那么一切会很顺利,Win7系统中有访问accdb的相应的组件,使用C#调用就可以。如果是mdb,以往在XP上是使用Jet方式访问,而在Win7上已经不推荐使用Jet, 因为Win7系统本身就不带Jet的组件。从而出现了一个替代品Microsoft Access Engine,通过ACE的方式访问Access数据库,只要安装了这个,一切就OK. 但是安装的时候会出现问题。你从微软的主页下载,会发现有两个版本,一个是位32位系统准备的,另一个是为64位系统准备的。因为我们是Win7 64位系统,而且项目用到的dll都是64位的,所以要装Microsoft Access Engine-x64,但是安装的时候会检测到你机器上安装的是32位的Office,要求你把Office升级到64位,难道真的要大费周章的卸载并重装Office吗?解决方案还是有的。 使用 "/passive"命令来安装,例如"C:\directory path\AccessDatabaseEngine_x64.exe" /passive 安装完成后,查看注册表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\FilesPaths,删除mso.dll 问题就会解决,就可以使用C# ACE来访问Access数据库。 注意,第二步不能少,否则会出现Office Config配置问题,已启动Office就会重新安装Office.
个人分类: SAS实践|24 次阅读|0 个评论
分享 春节啦啦啦~~~
xulimei1986 2014-1-24 11:15
/*文件合并工具*/ # -*- coding: cp936 -*- import glob files=glob.glob('*_*')#这个改文件格式 w=open('comb.txt','w')#这个改输出结果 #w.write('推广员编号,姓名,申请ip,地址,玩家id,服务器id,昵称,等级,激活ip,地址,激活时间,消费\n') for wenjian in files: f=open(wenjian) for i in f: #if '推广员编号' in i: #continue w.write('%s%s'%(wenjian,i)) f.close() w.close() /**********取文件中首个字符为日期时间型的数据******/ #coding:gb2312 import time filename="system_ogoss.log_20131126.log" def is_valid_date(str): try: time.strptime(str, "%Y-%m-%d %X") return True except: return False f=open(filename) r=open(filename+"_.result", "w") for s in f: if not s.strip():continue if is_valid_date(s ): r.write(s) r.close() raw_input("Done") /*******取某个字段后面的数据************/ #coding:gb2312 file_name="lj.instance.2013-12-31.log" span="log=" r=open(file_name+"_result.txt", "w") f=open(file_name) for s in f: if not s.strip():continue r.write(s.split(span) ) r.close() /**********去掉非日期格式的数据行**********/ #coding:gb2312 import time,re regx=re.compile(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}') filename="2013-11-10-chat.log" f=open(filename, "rb").read().replace("\r","").split("\n") r=open(filename+"_.result", "w") for s in f: if not s.strip():continue if regx.search(s ): r.write(s+"\n") r.close() raw_input("Done") /************匹配字段的脚本**********/ # -*- coding: cp936 -*- import glob,gzip,sys,datetime,time ty=sys.getfilesystemencoding() s={} logs=glob.glob('*.log') for z in logs: print z for r in open(z): try: sr=r.decode('utf-8').encode(ty).split(',',15) except: sr=r.split(',',15) fn=sr .split(':') .strip(),sr .split(':') .strip() if "@" not in sr : urs=sr .split(':') .strip()+"@163.com" else: urs=sr .split(':') .strip() if s.has_key(fn)==False: s =urs w=open('再流失样本流通记录(加帐号).txt','w+') for ii in open('11.1-11.30道具消费.txt'): #for ii in open(i0): try: i=ii.decode('utf-8').encode(ty) except: i=ii si=i.split(',') if len(si)==23: fwq=si .strip() yjs=si .strip() fy=fwq,yjs mjs=si .strip() fm=fwq,mjs yurs='未匹配' murs='未匹配' if s.has_key(fy): yurs=s if s.has_key(fm): murs=s w.write('%s,%s,%s\n'%(yurs,murs,i.strip())) w.close() /**********自动下载数据的脚本**********/ #---coding:cp936---# import urllib,urllib2,cookielib,socket,time,os,re,datetime,random,sys,base64 import module if '__main__'==__name__: self_module=module.self_module date='2014-01-23' log_out_reqh=self_module().down_out(date) out_lines=urllib2.urlopen(log_out_reqh) w=open('%s_out.log'%date,'w') for line in out_lines: w.write(line.strip()+'\n') w.close() log_in_reqh=self_module().down_in(date) in_lines=urllib2.urlopen(log_in_reqh) w=open('%s_in.log'%date,'w') for line in in_lines: w.write(line.strip()+'\n') w.close()
0 个评论
分享 merge数组 按变量 52 of 70
yukai08008 2013-3-13 17:08
结果不是 jo 186 . ja 2121 a joan 4695 . . 3567 fi joan 4698 m John 5463 accouting 而是 Obs Name empid department 1 Jill 1864 2 Jack 2121 accouting 3 3567 finance 4 Joan 4698 marketing 5 John 5463 accouting 因为指针是按照变量排序移动的 proc import dbms=excel out=one datafile='F:\raw material\_52 of 70_1.xls' replace; run; proc import dbms=excel out=two datafile='F:\raw material\_52 of 70_2.xls' replace; run; data all; merge one(in=o) two(in=d); by empid; if (o and not d) or (d and not o);/*其中有一个数组无效in=.,成立;注意指针下移是按照empid的排序的*/ run; proc print data=all; run;
个人分类: 学习笔记|0 个评论

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-19 11:08