本文整理汇总了Python中pandas.HDFStore.flush方法的典型用法代码示例。如果您正苦于以下问题:Python HDFStore.flush方法的具体用法?Python HDFStore.flush怎么用?Python HDFStore.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.HDFStore
的用法示例。
在下文中一共展示了HDFStore.flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove
# 需要导入模块: from pandas import HDFStore [as 别名]
# 或者: from pandas.HDFStore import flush [as 别名]
def remove(self, path):
s = HDFStore(self.path)
if path in s:
print("removing %s" % path)
s.remove(path)
s.flush(fsync=True)
s.close()
示例2: _put
# 需要导入模块: from pandas import HDFStore [as 别名]
# 或者: from pandas.HDFStore import flush [as 别名]
def _put(self, path, obj):
s = HDFStore(self.path)
if path in s:
print("updating %s" % path)
s.remove(path)
s.close()
s = HDFStore(self.path)
s[path] = obj
s.flush(fsync=True)
s.close()
示例3: to_frame_hdf
# 需要导入模块: from pandas import HDFStore [as 别名]
# 或者: from pandas.HDFStore import flush [as 别名]
def to_frame_hdf(self, store_path, store_key, df_cb=None, max_msg=None,
usecols=None, chunk_cnt=CHUNK_CNT, show_prog=True):
store = HDFStore(store_path, 'w')
df = self._to_frame(usecols, chunk_cnt, show_prog)
df['msg'] = df['msg'].apply(lambda m: m.encode('utf8'))
if df_cb is not None:
df_cb(df)
min_itemsize = {'kind': 20, 'msg': 255}
if max_msg is not None:
min_itemsize['msg'] = max_msg
store.put(store_key, df, format='table', min_itemsize=min_itemsize)
store.flush()
store.close()
示例4: cursor
# 需要导入模块: from pandas import HDFStore [as 别名]
# 或者: from pandas.HDFStore import flush [as 别名]
return conn.cursor(cursor_factory=DictCursor)
if __name__ == '__main__':
pre_cursor = cursor('pre')
post_cursor = cursor('post')
sql = 'SELECT x, y, z, value FROM points'''
# Get data in two threads to speed things up
pre_t = Thread(target=pre_cursor.execute, args=(sql,))
pre_t.start()
post_t = Thread(target=post_cursor.execute, args=(sql,))
post_t.start()
pre_t.join()
post_t.join()
# Create data frames
pre = DataFrame.from_records([dict(row) for row in pre_cursor])
post = DataFrame.from_records([dict(row) for row in post_cursor])
# Store data frame in HDF5 data store
store_file = 'points.h5'
store = HDFStore(store_file)
store['pre'] = pre
store['post'] = post
store.flush()
print('Data stored at {}'.format(store_file))