OriginPro
 
Loading...
Searching...
No Matches
originpro.dc.Connector Class Reference

Public Member Functions

 __init__ (self, wks, dctype='', keep_DC=True)
 
 __del__ (self)
 
 settings (self)
 
 source (self)
 
 source (self, s)
 
 new_sheet (self, name)
 
 imp (self, fname='', sel='', sparks=False)
 

Public Attributes

 keep = keep_DC
 
 wks = wks
 
 dc = dctype.lower()
 
 source = fname
 

Protected Member Functions

 _optn (self)
 

Protected Attributes

str _trLTname = '_trTmpDCSettings'
 
 _trOptn = None
 

Detailed Description

Data Connector
    Parameters:
        wks (DSheet): the worksheet or martix sheet to use the connector
        dctype(str):  Name of the connector, CSV, Excel etc
        keep_DC(bool): Keep the connector after import
    Example:
        import originpro as op
        f = op.path('e')+r'Samples\Import and Export\S15-125-03.dat'
        wks = op.find_sheet()
        dc = op.Connector(wks)
        ss = dc.settings()
        partial = ss['partial']
        partial[op.attrib_key('Use')]='1'
        partial['row']='10:20'
        dc.imp(f)

Member Function Documentation

◆ imp()

originpro.dc.Connector.imp ( self,
fname = '',
sel = '',
sparks = False )
Import file
Parameters:
    fname(string): source file name
    sel(string):selection
Returns:
    none
Examples:
    wks=op.find_sheet()
    dc=op.Connector(wks)
    f=op.path('e')+r'Samples\Import and Export\ASCII Simple.dat'
    dc.imp(f)

◆ new_sheet()

originpro.dc.Connector.new_sheet ( self,
name )
    Import a new selection into a new sheet

Parameters:
    name(str): selection, for example an Excel sheet name

Returns:
    None
Examples:
    dc.imp(f, sel='Oil')
    dc.new_sheet('Natural Gas')

◆ settings()

originpro.dc.Connector.settings ( self)
Parameters:
    none
Returns:
    Import settings
Examples:
    wks=op.find_sheet()
    dc=op.Connector(wks)
    ss=dc.settings()

◆ source() [1/2]

originpro.dc.Connector.source ( self)
Property getter returns the source of Data Connector
Parameters:
    none
Returns:
    (str) Data Source
Examples:
    wks=op.find_sheet()
    dc=op.Connector(wks)
    print(dc.source)

◆ source() [2/2]

originpro.dc.Connector.source ( self,
s )
    Property setter set the source of Data Connector
    Parameters:
        s(str): Data Source
    Returns:
        None
    Examples:
        wks=op.find_sheet()
        dc=op.Connector(wks)
        dc.source=op.path('e')+r'Samples\Import and Export\S15-125-03.dat'
        dc.imp()

The documentation for this class was generated from the following file: