-
Notifications
You must be signed in to change notification settings - Fork 40
/
skspec.pandas_utils.html
571 lines (499 loc) · 36.9 KB
/
skspec.pandas_utils.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pandas_utils Package — scikit-spectra 0.3.1-2 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/gallery.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootswatch-3.2.0/united/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.3.1-2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../_static/bootstrap-3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="top" title="scikit-spectra 0.3.1-2 documentation" href="../index.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body>
<a href="https://github.com/hugadams/scikit-spectra"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../index.html"><img src="../_static/logo.png" border="100" alt="sampledoc"/></a>
</div>
<a href="https://github.com/hugadams/scikit-spectra"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-inverse navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
skspec</a>
<span class="navbar-text navbar-version pull-left"><b>0.3</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../index.html">Jump to <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="APIMAIN.html">API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#primary-structures-spectrum-spectra-specstack">Primary Structures: Spectrum, Spectra, SpecStack</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#index-objects">Index Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#builtin-datasets">Builtin Datasets</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#io">IO</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#plotting">Plotting</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#graphical-user-interface-gui">Graphical User Interface (GUI)</a></li>
<li class="toctree-l2"><a class="reference internal" href="APIMAIN.html#two-dimensional-correlation-spectroscopy">Two-Dimensional Correlation Spectroscopy</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../support.html">Support</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../support.html#mailing-list">Mailing List</a></li>
<li class="toctree-l2"><a class="reference internal" href="../support.html#contribute">Contribute</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../tutorials.html">Tutorials</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorials.html#videos">Videos</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorials.html#minutes-to-scikit-spectra">10 Minutes to scikit-spectra</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorials.html#ipython-notebooks">IPython Notebooks</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../install.html">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../install.html#dependencies">Dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install.html#pip-install">Pip Install</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install.html#installation-from-source">Installation from source</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install.html#testing-installation">Testing Installation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../about.html">About</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../about.html#history-and-background">History and Background</a></li>
<li class="toctree-l2"><a class="reference internal" href="../about.html#related-scipy-libraries">Related Scipy Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../about.html#other-spectroscopy-libraries-tools-in-python">Other Spectroscopy Libraries/Tools in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../about.html#about-the-author">About the Author</a></li>
<li class="toctree-l2"><a class="reference internal" href="../about.html#acknowledgements">Acknowledgements</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../auto_examples/index.html">Examples</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../auto_examples/index.html#general-examples">General examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="../auto_examples/index.html#longer-examples">Longer examples</a></li>
</ul>
</li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">This Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">pandas_utils Package</a><ul>
<li><a class="reference internal" href="#module-skspec.pandas_utils.dataframeserial"><tt class="docutils literal"><span class="pre">dataframeserial</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-skspec.pandas_utils.df_attrhandler"><tt class="docutils literal"><span class="pre">df_attrhandler</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-skspec.pandas_utils.metadframe"><tt class="docutils literal"><span class="pre">metadframe</span></tt> Module</a></li>
</ul>
</li>
</ul>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" action="../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"><ul>
<li><a class="reference internal" href="#">pandas_utils Package</a><ul>
<li><a class="reference internal" href="#module-skspec.pandas_utils.dataframeserial"><tt class="docutils literal"><span class="pre">dataframeserial</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-skspec.pandas_utils.df_attrhandler"><tt class="docutils literal"><span class="pre">df_attrhandler</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-skspec.pandas_utils.metadframe"><tt class="docutils literal"><span class="pre">metadframe</span></tt> Module</a></li>
</ul>
</li>
</ul>
<form action="../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="col-md-12">
<div class="section" id="pandas-utils-package">
<h1>pandas_utils Package<a class="headerlink" href="#pandas-utils-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-skspec.pandas_utils.dataframeserial">
<span id="dataframeserial-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">dataframeserial</span></tt> Module<a class="headerlink" href="#module-skspec.pandas_utils.dataframeserial" title="Permalink to this headline">¶</a></h2>
<p>Serialization interface for custom DataFrame objects. Allows to save/load
for memory streams or files. Because one cannot serialize DataFrames with
custom attributes, this uses an intermediate object for that process. Plan
it implement pickling saved methods later (requires more work). These are meant to
supplant the DataFrame’s save() and load() methods when custom attributes must persist.</p>
<p>Note, this program assesses custom attributes by inspecting your DataFrame’s
attributes using Python’s builting function, dir(). It compares these to the
attributes of an empty DataFrame. This adds a bit of overhead, but should allow
this program to work with new versions of pandas, as Dataframe’s methods and attributes
are likely to change. Is there are better way to do this?</p>
<dl class="docutils">
<dt>The following four functions are defined:</dt>
<dd>df_dumps: Serialize a DataFrame into memory. Returns serialized stream.
df_dump: Serialize a DataFrame into a file. Returns None.
df_loads: Return a DataFrame from a serialized stream.
df_load: Return a Dataframe from a serialized file.</dd>
</dl>
<p>See bottom of file for test cases:</p>
<dl class="class">
<dt id="skspec.pandas_utils.dataframeserial.TempDump">
<em class="property">class </em><tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">TempDump</tt><big>(</big><em>dataframe</em>, <em>metadict</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#TempDump"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.TempDump" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Temporary class to dump DataFrame object with custom attributes. Custom attrubutes are
passed in as a dictionary and then temporarily stored upon serialization as _metadict. Upon
deserialization, the attributes and values are re-appended to the DataFrame automatically.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.df_dump">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">df_dump</tt><big>(</big><em>df</em>, <em>outfile</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#df_dump"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.df_dump" title="Permalink to this definition">¶</a></dt>
<dd><p>Save dataframe as a file.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.df_dumps">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">df_dumps</tt><big>(</big><em>df</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#df_dumps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.df_dumps" title="Permalink to this definition">¶</a></dt>
<dd><p>Save dataframe as a stream into memory.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.df_load">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">df_load</tt><big>(</big><em>infile</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#df_load"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.df_load" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns dataframe from a serialized file</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.df_loads">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">df_loads</tt><big>(</big><em>stream</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#df_loads"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.df_loads" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns dataframe from a serialized stream</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.print_customattr">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">print_customattr</tt><big>(</big><em>df</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/dataframeserial.html#print_customattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.print_customattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Formatted output of all custom attributes found in a DataFrame. For all
attributes and methods, use dir(df).</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.dataframeserial.randn">
<tt class="descclassname">skspec.pandas_utils.dataframeserial.</tt><tt class="descname">randn</tt><big>(</big><em>d0</em>, <em>d1</em>, <em>...</em>, <em>dn</em><big>)</big><a class="headerlink" href="#skspec.pandas_utils.dataframeserial.randn" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a sample (or samples) from the “standard normal” distribution.</p>
<p>If positive, int_like or int-convertible arguments are provided,
<cite>randn</cite> generates an array of shape <tt class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1,</span> <span class="pre">...,</span> <span class="pre">dn)</span></tt>, filled
with random floats sampled from a univariate “normal” (Gaussian)
distribution of mean 0 and variance 1 (if any of the <span class="math">\(d_i\)</span> are
floats, they are first converted to integers by truncation). A single
float randomly sampled from the distribution is returned if no
argument is provided.</p>
<p>This is a convenience function. If you want an interface that takes a
tuple as the first argument, use <cite>numpy.random.standard_normal</cite> instead.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>d0, d1, ..., dn</strong> : int, optional</p>
<blockquote>
<div><p>The dimensions of the returned array, should be all positive.
If no argument is given a single Python float is returned.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>Z</strong> : ndarray or float</p>
<blockquote class="last">
<div><p>A <tt class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1,</span> <span class="pre">...,</span> <span class="pre">dn)</span></tt>-shaped array of floating-point samples from
the standard normal distribution, or a single such float if
no parameters were supplied.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><tt class="xref py py-obj docutils literal"><span class="pre">random.standard_normal</span></tt></dt>
<dd>Similar, but takes a tuple as its argument.</dd>
</dl>
</div>
<p class="rubric">Notes</p>
<p>For random samples from <span class="math">\(N(\mu, \sigma^2)\)</span>, use:</p>
<p><tt class="docutils literal"><span class="pre">sigma</span> <span class="pre">*</span> <span class="pre">np.random.randn(...)</span> <span class="pre">+</span> <span class="pre">mu</span></tt></p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">()</span>
<span class="go">2.1923875335537315 #random</span>
</pre></div>
</div>
<p>Two-by-four array of samples from N(3, 6.25):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="mf">2.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="mi">3</span>
<span class="go">array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random</span>
<span class="go"> [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="module-skspec.pandas_utils.df_attrhandler">
<span id="df-attrhandler-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">df_attrhandler</span></tt> Module<a class="headerlink" href="#module-skspec.pandas_utils.df_attrhandler" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="skspec.pandas_utils.df_attrhandler.restore_attr">
<tt class="descclassname">skspec.pandas_utils.df_attrhandler.</tt><tt class="descname">restore_attr</tt><big>(</big><em>df</em>, <em>stored_attr</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/df_attrhandler.html#restore_attr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.df_attrhandler.restore_attr" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the attributes of the pandas dataframe using sotred_attr dictionary.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.df_attrhandler.store_attr">
<tt class="descclassname">skspec.pandas_utils.df_attrhandler.</tt><tt class="descname">store_attr</tt><big>(</big><em>df</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/df_attrhandler.html#store_attr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.df_attrhandler.store_attr" title="Permalink to this definition">¶</a></dt>
<dd><p>Store all the attributes in a dataframe that are not found in an empty dataframe
declared with DataFrame().</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.df_attrhandler.transfer_attr">
<tt class="descclassname">skspec.pandas_utils.df_attrhandler.</tt><tt class="descname">transfer_attr</tt><big>(</big><em>df1</em>, <em>df2</em>, <em>reversedeletion=False</em>, <em>speakup=True</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/df_attrhandler.html#transfer_attr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.df_attrhandler.transfer_attr" title="Permalink to this definition">¶</a></dt>
<dd><p>Transfer all the attributes from df1 to df2. If none found, returns df2.
Speakup keyword just adds print statements.
Reverse deletion means that all attributes in df2 that are not found in df1.</p>
</dd></dl>
</div>
<div class="section" id="module-skspec.pandas_utils.metadframe">
<span id="metadframe-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">metadframe</span></tt> Module<a class="headerlink" href="#module-skspec.pandas_utils.metadframe" title="Permalink to this headline">¶</a></h2>
<p>Provides composition class, MetaPandasObject, which is an ordinary python object that stores a Dataframe and
attempts to promote attributes and methods to the instance level (eg self.x instead of self.df.x). This object
can be subclassed and ensures persistence of custom attributes. The goal of this MetaPandasObject is to provide a
subclassing api beyond monkey patching (which currently fails in persisting attributes upon most method returns
and upon derialization.</p>
<dl class="class">
<dt id="skspec.pandas_utils.metadframe.MetaDataFrame">
<em class="property">class </em><tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">MetaDataFrame</tt><big>(</big><em>*dfargs</em>, <em>**dfkwargs</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaDataFrame"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaDataFrame" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#skspec.pandas_utils.metadframe.MetaPandasObject" title="skspec.pandas_utils.metadframe.MetaPandasObject"><tt class="xref py py-class docutils literal"><span class="pre">skspec.pandas_utils.metadframe.MetaPandasObject</span></tt></a></p>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaDataFrame.columns">
<tt class="descname">columns</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaDataFrame.columns"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaDataFrame.columns" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaDataFrame.cousin">
<tt class="descname">cousin</tt><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaDataFrame.cousin" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DataFrame</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject">
<em class="property">class </em><tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">MetaPandasObject</tt><big>(</big><em>*dfargs</em>, <em>**dfkwargs</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Base composition for subclassing pandas DataFrame and Series.</p>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.cousin">
<tt class="descname">cousin</tt><em class="property"> = None</em><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.cousin" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.data">
<tt class="descname">data</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.data" title="Permalink to this definition">¶</a></dt>
<dd><p>Accesses self._frame. RETURNS COPY SO USER DOESNT OVERWRITE IN PLACE</p>
</dd></dl>
<dl class="method">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.deepcopy">
<tt class="descname">deepcopy</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.deepcopy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.deepcopy" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a deepcopy of self, including the dataframe.</p>
</dd></dl>
<dl class="method">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.dumps">
<tt class="descname">dumps</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.dumps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.dumps" title="Permalink to this definition">¶</a></dt>
<dd><p>Output TimeSpectra into a pickled string in memory.</p>
</dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.iloc">
<tt class="descname">iloc</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.iloc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.iloc" title="Permalink to this definition">¶</a></dt>
<dd><p>See pandas.Index.iloc; preserves metadata</p>
</dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.index">
<tt class="descname">index</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.index" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.ix">
<tt class="descname">ix</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.ix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.ix" title="Permalink to this definition">¶</a></dt>
<dd><p>Pandas Indexing. Note, this has been modified to ensure that series returns (eg ix[3])
still maintain attributes. To remove this behavior, replace the following:</p>
<p>self._ix = _MetaIXIndexer(self, _IXIndexer(self) ) –> self._ix=_IXIndexer(self)</p>
<p>The above works because slicing preserved attributes because the _IXIndexer is a python object
subclass.</p>
</dd></dl>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.loc">
<tt class="descname">loc</tt><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.loc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.loc" title="Permalink to this definition">¶</a></dt>
<dd><p>See pandas.Index.loc; preserves metadata</p>
</dd></dl>
<dl class="method">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.save">
<tt class="descname">save</tt><big>(</big><em>outname</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.save" title="Permalink to this definition">¶</a></dt>
<dd><p>Takes in str or opened file and saves. cPickle.dump wrapper.</p>
</dd></dl>
<dl class="method">
<dt id="skspec.pandas_utils.metadframe.MetaPandasObject.subtract">
<tt class="descname">subtract</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaPandasObject.subtract"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaPandasObject.subtract" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="skspec.pandas_utils.metadframe.MetaSeries">
<em class="property">class </em><tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">MetaSeries</tt><big>(</big><em>*dfargs</em>, <em>**dfkwargs</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#MetaSeries"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaSeries" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#skspec.pandas_utils.metadframe.MetaPandasObject" title="skspec.pandas_utils.metadframe.MetaPandasObject"><tt class="xref py py-class docutils literal"><span class="pre">skspec.pandas_utils.metadframe.MetaPandasObject</span></tt></a></p>
<dl class="attribute">
<dt id="skspec.pandas_utils.metadframe.MetaSeries.cousin">
<tt class="descname">cousin</tt><a class="headerlink" href="#skspec.pandas_utils.metadframe.MetaSeries.cousin" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Series</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="skspec.pandas_utils.metadframe.SubFoo">
<em class="property">class </em><tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">SubFoo</tt><big>(</big><em>a</em>, <em>b</em>, <em>*dfargs</em>, <em>**dfkwargs</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#SubFoo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.SubFoo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#skspec.pandas_utils.metadframe.MetaDataFrame" title="skspec.pandas_utils.metadframe.MetaDataFrame"><tt class="xref py py-class docutils literal"><span class="pre">skspec.pandas_utils.metadframe.MetaDataFrame</span></tt></a></p>
<p>Shows an example of how to subclass MetaPandasObject with custom attributes, a and b.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.metadframe.mload">
<tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">mload</tt><big>(</big><em>inname</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#mload"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.mload" title="Permalink to this definition">¶</a></dt>
<dd><p>Load MetaPandasObject from file</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.metadframe.mloads">
<tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">mloads</tt><big>(</big><em>string</em><big>)</big><a class="reference internal" href="../_modules/skspec/pandas_utils/metadframe.html#mloads"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#skspec.pandas_utils.metadframe.mloads" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a MetaPandasObject from string stored in memory.</p>
</dd></dl>
<dl class="function">
<dt id="skspec.pandas_utils.metadframe.randn">
<tt class="descclassname">skspec.pandas_utils.metadframe.</tt><tt class="descname">randn</tt><big>(</big><em>d0</em>, <em>d1</em>, <em>...</em>, <em>dn</em><big>)</big><a class="headerlink" href="#skspec.pandas_utils.metadframe.randn" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a sample (or samples) from the “standard normal” distribution.</p>
<p>If positive, int_like or int-convertible arguments are provided,
<cite>randn</cite> generates an array of shape <tt class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1,</span> <span class="pre">...,</span> <span class="pre">dn)</span></tt>, filled
with random floats sampled from a univariate “normal” (Gaussian)
distribution of mean 0 and variance 1 (if any of the <span class="math">\(d_i\)</span> are
floats, they are first converted to integers by truncation). A single
float randomly sampled from the distribution is returned if no
argument is provided.</p>
<p>This is a convenience function. If you want an interface that takes a
tuple as the first argument, use <cite>numpy.random.standard_normal</cite> instead.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>d0, d1, ..., dn</strong> : int, optional</p>
<blockquote>
<div><p>The dimensions of the returned array, should be all positive.
If no argument is given a single Python float is returned.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>Z</strong> : ndarray or float</p>
<blockquote class="last">
<div><p>A <tt class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1,</span> <span class="pre">...,</span> <span class="pre">dn)</span></tt>-shaped array of floating-point samples from
the standard normal distribution, or a single such float if
no parameters were supplied.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><tt class="xref py py-obj docutils literal"><span class="pre">random.standard_normal</span></tt></dt>
<dd>Similar, but takes a tuple as its argument.</dd>
</dl>
</div>
<p class="rubric">Notes</p>
<p>For random samples from <span class="math">\(N(\mu, \sigma^2)\)</span>, use:</p>
<p><tt class="docutils literal"><span class="pre">sigma</span> <span class="pre">*</span> <span class="pre">np.random.randn(...)</span> <span class="pre">+</span> <span class="pre">mu</span></tt></p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">()</span>
<span class="go">2.1923875335537315 #random</span>
</pre></div>
</div>
<p>Two-by-four array of samples from N(3, 6.25):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="mf">2.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="mi">3</span>
<span class="go">array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random</span>
<span class="go"> [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
<br/>
<div id="sourcelink">
<a href="../_sources/API/skspec.pandas_utils.txt"
rel="nofollow">Source</a>
</div>
</p>
<p>
© Copyright 2014, Adam Hughes, ReevesLab, George Washington University.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.3.<br/>
</p>
</div>
</footer>
</body>
</html>