FrontPage / Python / Pandas

[[FrontPage/Python/Scipy+Numpy]]

** Pandas [#n923875a]

** ipython:  表示する行数を設定 [#l5a41af2]
 pd.options.display.max_rows=5

** 信号データの呼び出し [#hc4ec7ef]
https://gist.github.com/peace098beat/76005a2eb8448dea008c

# coding: utf-8
	# In[4]:

# # Pandasで信号のロード
	import pandas as pd
	import numpy as np

# In[3]:

get_ipython().magic(u'matplotlib inline')
	# In[39]:

	import os
	import sys

# In[4]:

import pandas as pd
import numpy as np
	# In[40]:

	pd.options.display.max_rows=5

# In[39]:

import os
import sys
	# In[41]:

	# カレントパスの取得
	BASE_DIR = os.path.dirname(sys.argv[0])
	# パスの追加
	sys.path.append('E:\Python\GolfClassification/')

# In[40]:

pd.options.display.max_rows=5
	# In[42]:

	from FiSig.AudioManager import AudioManager

# In[41]:

# カレントパスの取得
BASE_DIR = os.path.dirname(sys.argv[0])
# パスの追加
sys.path.append('E:\Python\GolfClassification/')
	# In[82]:

	audiofile_path_s = ['./wav/audio1.wav', './wav/audio2.wav', './wav/audio3.wav']
	audiofile_path_s

# In[42]:

from FiSig.AudioManager import AudioManager
	# In[84]:

	audiofile_basename_s = [os.path.basename(path) for path in audiofile_path_s]
	audiofile_basename_s

# In[82]:

audiofile_path_s = ['./wav/audio1.wav', './wav/audio2.wav', './wav/audio3.wav']
audiofile_path_s
	# In[86]:

	audioname_s = [os.path.splitext(basename)[0] for basename in audiofile_basename_s]
	audioname_s

# In[84]:

audiofile_basename_s = [os.path.basename(path) for path in audiofile_path_s]
audiofile_basename_s
	# In[87]:

	audio_manager_s = [AudioManager(f) for f in audiofile_path_s]

# In[86]:

audioname_s = [os.path.splitext(basename)[0] for basename in audiofile_basename_s]
audioname_s
	# In[88]:

	audio_data_s = [am.getData(mode='norm') for am in audio_manager_s]
	audio_data_s

# In[87]:

audio_manager_s = [AudioManager(f) for f in audiofile_path_s]
	# In[89]:

	fs = audio_manager_s[0].getFs()

# In[88]:

audio_data_s = [am.getData(mode='norm') for am in audio_manager_s]
audio_data_s
	# In[90]:

	N = audio_data_s[0].shape[0]
	N

# In[89]:

fs = audio_manager_s[0].getFs()
	# ## PandasのDataFrameを使ってみる

	# In[94]:

# In[90]:
	table_dict = dict(zip(audioname_s, audio_data_s))
	table_dict

N = audio_data_s[0].shape[0]
N

	# In[95]:

# ## PandasのDataFrameを使ってみる
	trange = np.linspace(0, N/float(fs), N)
	trange.shape

# In[94]:

table_dict = dict(zip(audioname_s, audio_data_s))
table_dict
	# In[96]:

	df = pd.DataFrame(table_dict, trange)
	df

# In[95]:

trange = np.linspace(0, N/float(fs), N)
trange.shape
	# In[98]:

	df[[1]]

# In[96]:

df = pd.DataFrame(table_dict, trange)
df


# In[98]:

df[[1]]


# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:




# In[ ]:

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS