@@ -19,37 +19,37 @@ General terminology translation
19
19
:header: "pandas", "SPSS"
20
20
:widths: 20, 20
21
21
22
- `` DataFrame ` `, data file
22
+ :class: ` DataFrame `, data file
23
23
column, variable
24
24
row, case
25
25
groupby, split file
26
- `` NaN ` `, system-missing
26
+ :class: ` NaN `, system-missing
27
27
28
- `` DataFrame ` `
28
+ :class: ` DataFrame `
29
29
~~~~~~~~~~~~~
30
30
31
- A `` DataFrame ` ` in pandas is analogous to an SPSS data file - a two-dimensional
31
+ A :class: ` DataFrame ` in pandas is analogous to an SPSS data file - a two-dimensional
32
32
data source with labeled columns that can be of different types. As will be shown in this
33
33
document, almost any operation that can be performed in SPSS can also be accomplished in pandas.
34
34
35
- `` Series ` `
35
+ :class: ` Series `
36
36
~~~~~~~~~~
37
37
38
- A `` Series `` is the data structure that represents one column of a `` DataFrame ` `. SPSS doesn't have a
39
- separate data structure for a single variable, but in general, working with a `` Series ` ` is analogous
38
+ A :class: ` Series ` is the data structure that represents one column of a :class: ` DataFrame `. SPSS doesn't have a
39
+ separate data structure for a single variable, but in general, working with a :class: ` Series ` is analogous
40
40
to working with a variable in SPSS.
41
41
42
- `` Index ` `
42
+ :class: ` Index `
43
43
~~~~~~~~~
44
44
45
- Every `` DataFrame `` and `` Series `` has an `` Index ` ` -- labels on the *rows * of the data. SPSS does not
45
+ Every :class: ` DataFrame ` and :class: ` Series ` has an :class: ` Index ` -- labels on the *rows * of the data. SPSS does not
46
46
have an exact analogue, as cases are simply numbered sequentially from 1. In pandas, if no index is
47
- specified, a `` RangeIndex ` ` is used by default (first row = 0, second row = 1, and so on).
47
+ specified, a :class: ` RangeIndex ` is used by default (first row = 0, second row = 1, and so on).
48
48
49
- While using a labeled `` Index `` or `` MultiIndex ` ` can enable sophisticated analyses and is ultimately an
50
- important part of pandas to understand, for this comparison we will essentially ignore the `` Index ` ` and
51
- just treat the `` DataFrame ` ` as a collection of columns. Please see the :ref: `indexing documentation<indexing> `
52
- for much more on how to use an `` Index ` ` effectively.
49
+ While using a labeled :class: ` Index ` or :class: ` MultiIndex ` can enable sophisticated analyses and is ultimately an
50
+ important part of pandas to understand, for this comparison we will essentially ignore the :class: ` Index ` and
51
+ just treat the :class: ` DataFrame ` as a collection of columns. Please see the :ref: `indexing documentation<indexing> `
52
+ for much more on how to use an :class: ` Index ` effectively.
53
53
54
54
55
55
Copies vs. in place operations
@@ -81,7 +81,7 @@ In SPSS, you would use File > Open > Data to import a CSV file:
81
81
82
82
The pandas equivalent would use :func: `read_csv `:
83
83
84
- .. ipython :: python
84
+ .. code-block :: python
85
85
86
86
url = (
87
87
" https://raw.githubusercontent.com/pandas-dev"
@@ -116,7 +116,7 @@ In SPSS, filtering is done through Data > Select Cases:
116
116
117
117
In pandas, boolean indexing can be used:
118
118
119
- .. ipython :: python
119
+ .. code-block :: python
120
120
121
121
tips[tips[" total_bill" ] > 10 ]
122
122
@@ -133,7 +133,7 @@ In SPSS, sorting is done through Data > Sort Cases:
133
133
134
134
In pandas, this would be written as:
135
135
136
- .. ipython :: python
136
+ .. code-block :: python
137
137
138
138
tips.sort_values([" sex" , " total_bill" ])
139
139
@@ -194,7 +194,7 @@ In SPSS, split-file analysis is done through Data > Split File:
194
194
195
195
The pandas equivalent would be:
196
196
197
- .. ipython :: python
197
+ .. code-block :: python
198
198
199
199
tips.groupby(" sex" )[[" total_bill" , " tip" ]].agg([" mean" , " std" , " min" , " max" ])
200
200
0 commit comments