Skip to content

Commit

Permalink
Merge pull request #27 from martinup/master
Browse files Browse the repository at this point in the history
as_dataframe_withtimeindex added which converts the whole TDMS to a p…
  • Loading branch information
adamreeve committed Jul 8, 2015
2 parents 0941a2a + eb599b4 commit 4038d27
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nptdms/tdms.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,22 @@ def as_dataframe(self):
temp[key] = value.data
return pd.DataFrame.from_dict(temp)

def as_dataframe_withtimeindex(self):
"""
Converts the TDMS file to a DataFrame and include time index
:return: The full TDMS file data.
:rtype: Pandas DataFrame
"""

import pandas as pd # only loaded when needed

temp = {}
for key, value in self.objects.items():
if value.has_data:
temp[key] = pd.Series(data=value.data, index=value.time_track())
return pd.DataFrame.from_dict(temp)


class _TdmsSegment(object):

__slots__ = ['position', 'num_chunks', 'ordered_objects', 'toc', 'version',
Expand Down

0 comments on commit 4038d27

Please sign in to comment.