L*******r 发帖数: 1011 | 1 My words on this:
dataset way is more scalable, especially for busy service(a lot of
connections). But datareader is faster if not that many requests.
hehe, dataset just "looks faster" for busy web serive.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bd
adotnetarch031.asp
In all of the preceding tests, we saw that DataReader outperformed DataSet. As
mentioned earlier, the DataReader offers better performance because it avoids
the performance and memory overhead ass |
|
|
a**y 发帖数: 335 | 3 From my experience, most of the time, DataReader could do the job fine except
sometimes, I need some complex calculation towards a big data set. Probably,
i could achieve the same goal with SQL, but that would make the database too
slow. In this case, dataset is used. We do some sacrifice some memory, but
we saved the database.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bd
DataSet.
the
data,
enough
the |
|
|
|
p**r 发帖数: 5853 | 6 最愚蠢的,不涉及算法的方法就是,做个loop,减到0为止
数据库部分:
sql query: select quantity from table where item='Fish' order by date.
程序部分:
datareader=result of sql query
soldAmount=6;
while(soldAmount>0 && datareader.CanReadNext)
{
//获得每天的库存
int tempQuanity=int(datareader["Quantity"]);
//累减
soldAmount-=tempQuantity;
//update table by column key
}
语法是乱写的,但是你应该可以看懂,PHP很久不搞了。
不过这是最笨的方法,如果用算法,运行速度会更快。 |
|
s**h 发帖数: 477 | 7 先拜谢大牛的帮助
我的问题:
刚开始学用python做自动股票交易, 是跟着youtube 上一个视频学的, 但是遇到一个
error, 不知道怎么解决。求帮助
=========================================
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
start = dt.datetime(2010, 1, 1)
end = dt.datetime(2016, 12, 31)
df = web.DataReader('AAPL', start, end)
print(df.head())
========================================
程序问题
C:UsersXXXAppDataLocalContinuumAnaconda3python.exe... 阅读全帖 |
|
i**p 发帖数: 902 | 8 still has error on eventsXMLDoc.WriteAttributeString("id", dataReader["
categoryID"]);
CS1502: The best overloaded method match for 'System.Xml.XmlWriter.
WriteAttributeString(string, string)' has some invalid arguments
Here is the source code.
System.Data.OleDb.OleDbDataReader dataReader =
dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
System.Xml.XmlTextWriter eventsXMLDoc = new
System.Xml.XmlTextWriter(Response.OutputStream, Encoding.UTF8);
// generate XM |
|
E******A 发帖数: 53 | 9 int id =(int)(dataReader.IsDBNull() ? 0 : dataReader.GetInt32(i));
//i 代表 categoryID 在SQL查询语句中的顺序
eventsXMLDoc.WriteAttributeString("id", id.ToString()); |
|
S***k 发帖数: 370 | 10 If the return recodes set is too large, outofmemory exception may be thrown
if using dataadapter. DataReader may be helpful to such case.
If DataReader even no help, you may probably have to modify the stored
procedure. |
|
x******a 发帖数: 6336 | 11 其实问题是为什么goog在yahoo上只有24个数据?
from pandas.io.data import DataReader
from datetime import datetime
goog=DataReader("GOOG", 'yahoo', datetime(2000,1,1), datetime(2014, 4,30))
In [52]:
len(goog['Adj Close'])
Out[52]:
24 |
|
w*s 发帖数: 7227 | 12 Ok i found this code online, works fine except i want to see date in the
xlabel.
import numpy as np
import pandas
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick, candlestick2
import matplotlib.dates as mdates
from pandas.io.data import DataReader
import datetime
# get daily stock price data from yahoo finance for S&P500
start = datetime.datetime(2015, 11, 1)
end = datetime.datetime(2016, 2, 11)
SP = DataReader("spy", "yahoo", start, end)
SP.reset_index(inplace=True)... 阅读全帖 |
|
p********l 发帖数: 279 | 13 1. sp_helplogins, sp_dropalias, sp_droplogin, sp_dropuser
2. Actually they already can view the source as datareader. |
|
w**2 发帖数: 724 | 14 请问@6是什么意思?
我用ssms打开database看了,一切正常。
求救,大谢!
Unhandled Exception: System.Data.Entity.Infrastructure.DbUpdateException: An
error occurred while up
dating the entries. See the inner exception for details. ---> System.Data.
UpdateException: An error
occurred while updating the entries. See the inner exception for details. --
-> System.Data.SqlClient
.SqlException: The incoming tabular data stream (TDS) remote procedure call
(RPC) protocol stream is
incorrect. Parameter 9 ("@6"): The supplied value is... 阅读全帖 |
|
|
|
L*******r 发帖数: 1011 | 17
So the point here is using the "cache" in dataset to do computing, am I right? |
|
a**y 发帖数: 335 | 18 I mean, we saved a lot of database operations. |
|
L*******r 发帖数: 1011 | 19 Got you. I remembered some examples. SQL is not good at some sort of
calculation .
Thanks. :)
right? |
|
st 发帖数: 1685 | 20 nothing is good if it's over used. hehe. I always believe in something in
between. the previous manager likes "cool" M$ stuff, so they wrote sql proc
over 3k lines, which became a disaster to maintain, debug, optimize later.
also M$ sql server replication latency is a know issue, it can hardly be
determined when replication will be done and it causes heavy network traffic |
|
k****i 发帖数: 1072 | 21 Really?I mean the replication latency problem.I did the same thing in Sybase
replication server b4 and they worked well.Microsoft sql server is similar(if
not exact the same) to sybase.If it has such big latency problem,does it mean
that it's not suitbale for real time system?
btw,who can feed me the relationship(or history) between sybase sql server and
microsoft sql server?I am 2 lazy to do the research lah. |
|
st 发帖数: 1685 | 22
I would suspect so, due to this problem, we use our own middleware for
real time and delayed quote delivery. |
|
c**e 发帖数: 2558 | 23 dataReader["categoryID"] returns an object and not a string
you need to cast it to string
"] |
|
i**p 发帖数: 902 | 24 dataReader["categoryID"].ToString() ?
But when I use this in VB, it works without the cast. |
|
c**e 发帖数: 2558 | 25 (string)dataReader["categoryID"] |
|
i**p 发帖数: 902 | 26 you are not cute this time.
[InvalidCastException: Unable to cast object of type 'System.Int32' to type
'System.String'.]
dataReader["categoryID"].ToString() works. |
|
k***e 发帖数: 7933 | 27 you need to know the type of data in your dataReader!
type |
|
|
w*s 发帖数: 7227 | 29 x = pd.DataReader("xom", "yahoo", start, end)['Low']
print x.idxmin()
怎么返回int ?
谢谢各位! |
|
l*******m 发帖数: 1096 | 30 pd.DataReader("xom", "yahoo", start, end).reset_index()['Low'] |
|
w*s 发帖数: 7227 | 31 rawx = pd.DataReader("agio", "yahoo", start, end)['Low']
print "-----00------"
print rawx[0:2]
print rawx[0:2].index
print rawx[0:2].index.values
出来结果
-----00------
Date
2015-12-01 62.330002
2015-12-02 63.730000
Name: Low, dtype: float64
DatetimeIndex(['2015-12-01', '2015-12-02'], dtype='datetime64[ns]', name=u'
Date', freq=None)
['2015-11-30T19:00:00.000000000-0500' '2015-12-01T19:00:00.000000000-0500']
最后2行为啥时间不一样? |
|
w*s 发帖数: 7227 | 32 以前电脑太慢,于是在新电脑上装environment: vs 2015, ms sql 2014.
然后发现EntityFramework全升级了,以前程序通通完蛋,折腾几次以后烦了,扔掉换
method 2: python的程序。
然后安装python后,发现pandas换成什么它奶奶的pandas-datareader, 以前的程序也
完蛋了。
尼玛的我整天忙着升级,根本没时间真正去写程序。 |
|
r***e 发帖数: 127 | 33 web.DataReader('AAPL', start, end)里缺 data source? |
|
|
t*m 发帖数: 7 | 35 有一个85900*43的数据dat
用matlab的textread直接读读不出来
说是
??? Trouble reading number from file (row 1, field 1) ==> MATLAB 5.0 MAT-
file, Platform: PCWIN, Created
Error in ==> textread at 177
[varargout{1:nlhs}]=dataread('file',varargin{:});
但是在matlab里面用鼠标双击可以打开,为什么?
谢谢 |
|
x******e 发帖数: 42 | 36 現有500 excel files and these file names are stored in another file called
file.dat.
How to quickly import these files (500 excel files) and stored as SAS files
respectly after transposing them?
I wrote the code for a single file, but have to run the macro 500 times with
different numbers. It will be tedious.......... Any other convenient way
by taking advantage of the file.dat?
3xs!!!
%macro dataread(number);
PROC IMPORT OUT= file&number
DATAFILE= "C\chart_data\CR&number..xls"
DBMS |
|