dataformat

T-SQL calculating average time

拜拜、爱过 提交于 2019-12-05 12:22:43
问题 I have a problem with calculating average time. This is the case: i have multiple rows, in each row there is data in time format so I need to calculate an average time of all rows and multiply it with number of rows but of course I have a problem with data format because I need to multiply time with integer Can somebody help me with some advice? thnx Here is some data: times 00:00:00.7400000 00:00:01.1870000 00:00:00.6430000 00:00:00.6100000 00:00:12.9570000 00:00:01.1000000 00:00:00.7400000

T-SQL calculating average time

試著忘記壹切 提交于 2019-12-04 02:00:27
I have a problem with calculating average time. This is the case: i have multiple rows, in each row there is data in time format so I need to calculate an average time of all rows and multiply it with number of rows but of course I have a problem with data format because I need to multiply time with integer Can somebody help me with some advice? thnx Here is some data: times 00:00:00.7400000 00:00:01.1870000 00:00:00.6430000 00:00:00.6100000 00:00:12.9570000 00:00:01.1000000 00:00:00.7400000 00:00:00.5300000 00:00:00.6330000 00:00:01.6000000 00:00:02.6200000 00:00:01.0300000 00:00:01.9630000

matplotlib imshow() with irregular spaced data points

一曲冷凌霜 提交于 2019-12-01 04:26:38
I am trying to put some data into an imshow() plot. My problem is that the data does not come as a MxN array but as a 3xN array (x- and y coordinate and value). The points are NOT arranged as a regular grid but lie within [xmin,xmax,ymin and ymax]=[-pi/2,pi/2,0,3.5]. In [117]: shape(data) Out[117]: (3L, 102906L) How can I get a nice image plot from that data? Thank you very much for any help. btw the data represents temperature values on the surface of a rod as a function of axial and azimuthal position, think of a cfd-mesh. I recommend using the griddata-method for interpolation. A sample

matplotlib imshow() with irregular spaced data points

不羁岁月 提交于 2019-12-01 01:43:08
问题 I am trying to put some data into an imshow() plot. My problem is that the data does not come as a MxN array but as a 3xN array (x- and y coordinate and value). The points are NOT arranged as a regular grid but lie within [xmin,xmax,ymin and ymax]=[-pi/2,pi/2,0,3.5]. In [117]: shape(data) Out[117]: (3L, 102906L) How can I get a nice image plot from that data? Thank you very much for any help. btw the data represents temperature values on the surface of a rod as a function of axial and

Long and wide data – when to use what? [closed]

家住魔仙堡 提交于 2019-11-29 01:57:05
I'm in the process of compiling data from different data sets into one data set for analysis. I'll be doing data exploration, trying different things to find out what regularities may be hidden in the data, so I don't currently have a specific method in mind. Now I'm wondering if I should compile my data into long or wide format. Which format should I use, and why? I understand that data can be reshaped from long to wide or vice versa, but the mere existence of this functionality implies that the need to reshape sometimes arises and this need in turn implies that a specific format might be

Python - mysqlDB, sqlite result as dictionary

≡放荡痞女 提交于 2019-11-28 17:56:28
When I do someting like sqlite.cursor.execute("SELECT * FROM foo") result = sqlite.cursor.fetchone() I think have to remember the order the columns appear to be able to fetch them out, eg result[0] is id result[1] is first_name is there a way to return a dictionary? so I can instead just use result['id'] or similar? The problem with the numbered columns is, if you write your code then insert a column you might have to change the code eg result[1] for first_name might now be a date_joined so would have to update all the code... David Beazley has a nice example of this in his Python Essential

Python - mysqlDB, sqlite result as dictionary

ε祈祈猫儿з 提交于 2019-11-27 10:56:03
问题 When I do someting like sqlite.cursor.execute("SELECT * FROM foo") result = sqlite.cursor.fetchone() I think have to remember the order the columns appear to be able to fetch them out, eg result[0] is id result[1] is first_name is there a way to return a dictionary? so I can instead just use result['id'] or similar? The problem with the numbered columns is, if you write your code then insert a column you might have to change the code eg result[1] for first_name might now be a date_joined so

Writing Fortran unformatted files with Python

南楼画角 提交于 2019-11-26 21:42:59
问题 I have some single-precision little-endian unformatted data files written by Fortran77. I am reading these files using Python using the following commands: import numpy as np original_data = np.dtype('float32') f = open(file_name,'rb') original_data = np.fromfile(f,dtype='float32',count=-1) f.close() After some data manipulation in Python, I (am trying to) write them back in the original format using Python using the following commands: out_file = open(output_file,"wb") s = struct.pack('f'

How can I get dict from sqlite query?

若如初见. 提交于 2019-11-26 17:12:01
db = sqlite.connect("test.sqlite") res = db.execute("select * from table") With iteration I get lists coresponding to the rows. for row in res: print row I can get name of the columns col_name_list = [tuple[0] for tuple in res.description] But is there some function or setting to get dictionaries instead of list? {'col1': 'value', 'col2': 'value'} or I have to do myself? You could use row_factory , as in the example in the docs: import sqlite3 def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d con = sqlite3.connect(":memory:") con