In [1]:
import pandas as pd

In [2]:
probe_spec = pd.read_csv('NiPOD-ProbeSpec.csv')

Let's see what the column names that end in 'ID' are. Those are probably primary keys and foreign keys.


In [3]:
for col in probe_spec.columns:
    if col.endswith('ID'):
        print col


DesignID
DesignTypeID
ManufactureID
N2TProductID
PackageID
ProbeTypeID

First, let's set the index to what I think is the primary key


In [4]:
probe_spec.set_index('DesignID',inplace=True)
probe_spec.head()


Out[4]:
DesignName DesignTypeID DisplaySiteFontSize DisplaySiteSize DisplaySiteSpacing FirstChannelYSpacing ManufactureID N2TProductID NumChannel NumShank ... ShankWidth SiteArea TetrodeOffsetLeft TetrodeOffsetRight TetrodeOffsetUp TextBoxHeight TextBoxPhaseWidth TextBoxWidth TrueShankLength TrueSiteSpacing
DesignID
1 A16x1-3mm-100-125-413-HC16_21mm 3 8.25 30 8 80 1 3167 16 16 ... 50 413 5 3 5 15 30 30 3 100
2 A16x1-3mm-100-125-413-HP16_21mm 3 8.25 30 8 80 1 3168 16 16 ... 50 413 5 3 5 15 30 30 3 100
3 A16x1-3mm-100-125-413-MRCM16 3 8.25 30 8 80 1 3171 16 16 ... 50 413 5 3 5 15 30 30 3 100
4 A16x1-3mm-100-125-413-Z16 3 8.25 30 8 80 1 3164 16 16 ... 50 413 5 3 5 15 30 30 3 100
5 A16x1-3mm-100-125-703-A16 3 8.25 30 8 80 1 3172 16 16 ... 50 703 5 3 5 15 30 30 3 100

5 rows × 28 columns


In [5]:
design_type = pd.read_csv('NiPOD-DesignType.csv')
for col in design_type.columns:
    if col.endswith('ID'):
        print col
design_type.head()


DesignTypeID
Out[5]:
DefaultDisplaySiteFontSize DefaultDisplaySiteSize DefaultDisplaySiteSpacing DefaultExtraNoteStartingXLocation DefaultFirstChannelYSpacing DefaultNumChannel DefaultNumShank DefaultNumSitePerShank DefaultShankHeight DefaultShankSpace ... DefaultShankWidth DefaultSiteArea DefaultTetrodeOffsetLeft DefaultTetrodeOffsetRight DefaultTetrodeOffsetUp DefaultTextBoxHeight DefaultTextBoxPhaseWidth DefaultTextBoxWidth DesignType DesignTypeID
0 8.25 30 3 25 80 0 1 0 600 29 ... 40 177 5 3 5 15 29 29 Linear 3
1 8.25 30 3 25 80 0 1 0 600 66 ... 40 121 5 3 5 15 29 29 Tetrode 4
2 8.25 30 3 25 80 0 1 0 600 29 ... 40 NaN 5 3 5 15 29 29 Custom 5

3 rows × 22 columns


In [6]:
probe_spec = probe_spec.merge(design_type, on='DesignTypeID')

In [7]:
manufacture = pd.read_csv('NiPOD-Manufacture.csv')
for col in manufacture.columns:
    if col.endswith('ID'):
        print col
manufacture.head()


ManufactureID
Out[7]:
Description ManufactureID
0 NeuroNexus Technologies 1

In [8]:
probe_spec = probe_spec.merge(manufacture, on='ManufactureID')

In [9]:
package = pd.read_csv('NiPOD-ProbePackage.csv')
for col in package.columns:
    if col.endswith('ID'):
        print col
package.head()


N2TID
PackageID
Out[9]:
N2TID PackageID PackageName
0 NaN 1 A16 - a1x16
1 NaN 2 A16 - a4x4
2 NaN 3 A16 - a2x2tet
3 NaN 4 A16 - a4x1tet
4 NaN 5 CM16 - a1x16

In [10]:
probe_spec = probe_spec.merge(package, on='PackageID')

In [11]:
probe_type = pd.read_csv('NiPOD-ProbeType.csv')
for col in probe_type.columns:
    if col.endswith('ID'):
        print col
probe_type.head()


ProbeTypeID
Out[11]:
ProbeType ProbeTypeID
0 A-Style Probe 1
1 C-Style Probe 3
2 E-Style Probe 4
3 AX-Style Probe 6

In [12]:
probe_spec = probe_spec.merge(probe_type, on='ProbeTypeID')

In [13]:
probe_spec.head()


Out[13]:
DesignName DesignTypeID DisplaySiteFontSize DisplaySiteSize DisplaySiteSpacing FirstChannelYSpacing ManufactureID N2TProductID NumChannel NumShank ... DefaultTetrodeOffsetRight DefaultTetrodeOffsetUp DefaultTextBoxHeight DefaultTextBoxPhaseWidth DefaultTextBoxWidth DesignType Description N2TID PackageName ProbeType
0 A16x1-3mm-100-125-413-HC16_21mm 3 8.25 30 8 80 1 3167 16 16 ... 3 5 15 29 29 Linear NeuroNexus Technologies NaN HC16 - a16x1 A-Style Probe
1 A16x1-3mm-100-125-703-HC16_21mm 3 8.25 30 8 80 1 3177 16 16 ... 3 5 15 29 29 Linear NeuroNexus Technologies NaN HC16 - a16x1 A-Style Probe
2 A16x1-3mm-100-125-177-HC16_21mm 3 8.25 30 8 80 1 3157 16 16 ... 3 5 15 29 29 Linear NeuroNexus Technologies NaN HC16 - a16x1 A-Style Probe
3 A16x1-3mm-100-125-413-HP16_21mm 3 8.25 30 8 80 1 3168 16 16 ... 3 5 15 29 29 Linear NeuroNexus Technologies NaN HP16 - a16x1 A-Style Probe
4 A16x1-3mm-100-125-703-HP16_21mm 3 8.25 30 8 80 1 3178 16 16 ... 3 5 15 29 29 Linear NeuroNexus Technologies NaN HP16 - a16x1 A-Style Probe

5 rows × 53 columns


In [14]:
keep = ['DesignName',
 'FirstChannelYSpacing',
 'NumChannel',
 'NumShank',
 'NumSitePerShank',
 'OtherParameters',
 'PackageID',
 'ShankHeight',
 'ShankSpace',
 'ShankStartingXLocation',
 'ShankStartingYLocation',
 'ShankWidth',
 'SiteArea',
 'TetrodeOffsetLeft',
 'TetrodeOffsetRight',
 'TetrodeOffsetUp',
 'TrueShankLength',
 'TrueSiteSpacing',
 'DesignType',
 'PackageName',
 'ProbeType']

In [15]:
probe_spec = probe_spec[keep]

In [16]:
probe_spec.head()


Out[16]:
DesignName FirstChannelYSpacing NumChannel NumShank NumSitePerShank OtherParameters PackageID ShankHeight ShankSpace ShankStartingXLocation ... ShankWidth SiteArea TetrodeOffsetLeft TetrodeOffsetRight TetrodeOffsetUp TrueShankLength TrueSiteSpacing DesignType PackageName ProbeType
0 A16x1-3mm-100-125-413-HC16_21mm 80 16 16 1 NaN 142 500 35 50 ... 50 413 5 3 5 3 100 Linear HC16 - a16x1 A-Style Probe
1 A16x1-3mm-100-125-703-HC16_21mm 80 16 16 1 NaN 142 500 35 50 ... 50 703 5 3 5 3 100 Linear HC16 - a16x1 A-Style Probe
2 A16x1-3mm-100-125-177-HC16_21mm 80 16 16 1 NaN 142 500 35 50 ... 50 177 5 3 5 3 100 Linear HC16 - a16x1 A-Style Probe
3 A16x1-3mm-100-125-413-HP16_21mm 80 16 16 1 NaN 160 500 35 50 ... 50 413 5 3 5 3 100 Linear HP16 - a16x1 A-Style Probe
4 A16x1-3mm-100-125-703-HP16_21mm 80 16 16 1 NaN 160 500 35 50 ... 50 703 5 3 5 3 100 Linear HP16 - a16x1 A-Style Probe

5 rows × 21 columns


In [17]:
probe_spec.to_csv('NiPOD-ProbeSpec-denormalized.csv',
                 encoding='utf-8',
                 index=False)