File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -127,3 +127,42 @@ For example:
127
127
128
128
value = str
129
129
f " Unknown recived type, got: ' { type (value).__name__ } ' "
130
+
131
+
132
+ Imports (aim for absolute)
133
+ ==========================
134
+
135
+ In Python 3, absolute imports are recommended. In absolute import doing something
136
+ like ``import string `` will import the string module rather than ``string.py ``
137
+ in the same directory. As much as possible, you should try to write out
138
+ absolute imports that show the whole import chain from toplevel pandas.
139
+
140
+ For example:
141
+
142
+ **Good: **
143
+
144
+ .. code-block :: python
145
+
146
+ import pandas.core.common as com
147
+
148
+ Explicit relative imports are also supported in Python 3. In test code, it might
149
+ be easier to just reference local variables with explicit relative imports
150
+ (that start with ``. ``) for clarity, but in other code better to be absolute.
151
+
152
+ For example:
153
+
154
+ **Good (Test Code Only): **
155
+
156
+ .. code-block :: python
157
+
158
+ from .common import test_base
159
+
160
+ Implicit relative imports should never be used and is removed in Python 3.
161
+
162
+ For example:
163
+
164
+ **Wrong: **
165
+
166
+ .. code-block :: python
167
+
168
+ from common import test_base
You can’t perform that action at this time.
0 commit comments