<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@b9154422bed64bd6ad73917ba574e33a" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@808fa4d229ca444b9ed9ca1810ca973a">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@808fa4d229ca444b9ed9ca1810ca973a" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p style="text-align: left;">Cette section contient les solutions possibles aux exercices posés dans le module sur les bases de Python. Il y a plus d’une solution correcte pour la plupart des exercices. Les réponses sont donc données à titre indicatif.</p>
<p style="text-align: left;"><a class="reference external" href="/assets/courseware/v1/68dc5750b88bc742b53e5c8fcaae44c6/asset-v1:digitalearthafrica+DEA101-fr+2021+type@asset+block/06_download-python_solutions.ipynb" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer;" target="[object Object]">Télécharger le notebook de solutions de l’exercice</a></p>
<p style="text-align: left;">Pour visualiser les solutions sous la forme d’un notebook interactif, téléchargez le fichier sur votre machine et chargez-le dans le Sandbox de la même façon que dans les leçons sur les bases de Python.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@4b6208579b8240e3a82da5d609fc4b49" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@cd1fe379436b4ee7b03e16f28f8ece17">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@cd1fe379436b4ee7b03e16f28f8ece17" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<section id="1.1-Fill-the-asterisk-line-with-your-name-and-run-the-cell." style="box-sizing: border-box;">
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">1.1 Remplissez la ligne de l’astérisque avec votre nom et exécutez la cellule.</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[1]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid rgb(224, 224, 224); border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Remplissez ****** par votre nom et exécutez la cellule.</span>
<span class="n" style="box-sizing: border-box;">message</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="s2" style="box-sizing: border-box; color: #ba2121;">"My name is Python"</span>
<span class="n" style="box-sizing: border-box;">message</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[1]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">'My name is Python'</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">1.2 Vous pouvez ajouter de nouvelles cellules pour insérer du nouveau code à n’importe quel endroit d’un cahier. Cliquez sur l’icône <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">+</span></code> dans le menu supérieur pour ajouter une nouvelle cellule sous la cellule actuelle. Ajoutez une nouvelle cellule sous la cellule suivante, et utilisez-la pour imprimer la valeur de la variable <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">a</span></code>.</h3>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 16px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[2]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 16px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">a</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="mi" style="box-sizing: border-box; color: #666666;">365</span><span class="o" style="box-sizing: border-box; color: #666666;">*</span><span class="mi" style="box-sizing: border-box; color: #666666;">24</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Ajoutez une nouvelle cellule en dessous de celle-ci. Utilise-la pour calculer la valeur de la variable `a` </span>Ajoutez une nouvelle cellule en dessous de celle-ci. Utilise-la pour calculer la valeur de la variable `a`
</pre>
</div>
</div>
</div>
<div style="box-sizing: border-box; text-align: left;">
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[3]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">a</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none; text-align: left;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[3]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">8760</pre>
</div>
</div>
</div>
</div>
<div style="box-sizing: border-box; text-align: left;"><strong>Question </strong>: Maintenant, que se passe-t-il si vous remontez dans le notebook et exécutez une autre cellule contenant <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 16px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">print(a)</span></code>?</div>
</section>
<p style="text-align: left;"><strong style="box-sizing: border-box;">Réponse :</strong> Il devrait maintenant imprimer <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">8760</span></code> car “global state” signifie que la valeur de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">a</span></code> a été modifiée.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@882aba91e7ba4c0c99b7d5c628442550" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@f2fa3dd73f194726b15e57764bcda53b">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@f2fa3dd73f194726b15e57764bcda53b" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[4]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">numpy</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">np</span>
</pre>
</div>
</div>
</div>
<section id="2.1-Use-the-numpy-add-function-to-add-the-values-34-and-29-in-the-cell-below." style="box-sizing: border-box;">
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">2.1 Utilisez la fonction numpy <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">add</span></code> pour ajouter les valeurs <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">34</span></code> et <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">29</span></code> dans la cellule ci-dessous.</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[5]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Utilisez numpy-function add pour ajouter 34 et 29</span>
<span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">add</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">34</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">29</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[5]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">63</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">2.2 Déclarer un nouveau tableau dont le contenu est [5,4,3,2,1] et le découper pour sélectionner les 3 derniers éléments.</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[6]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Remplacez le symbole ? par les expressions et valeurs correctes</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Afficher le tableau</span>
<span class="n" style="box-sizing: border-box;">arr</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">array</span><span class="p" style="box-sizing: border-box;">([</span><span class="mi" style="box-sizing: border-box; color: #666666;">5</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">4</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">2</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">])</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Afficher le tableau</span>
<span class="n" style="box-sizing: border-box;">arr</span><span class="p" style="box-sizing: border-box;">[</span><span class="o" style="box-sizing: border-box; color: #666666;">-</span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">:]</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[6]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([3, 2, 1])</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">2.3 Sélectionnez tous les éléments du tableau ci-dessous, sauf le dernier, <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[15]</span></code>.</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[7]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">arr</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">array</span><span class="p" style="box-sizing: border-box;">([</span><span class="mi" style="box-sizing: border-box; color: #666666;">0</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">2</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">4</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">5</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">6</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">7</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">8</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">9</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">10</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">11</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">12</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">13</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">14</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">15</span><span class="p" style="box-sizing: border-box;">])</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Remplacez le symbole ? par les expressions et valeurs correctes</span>
<span class="n" style="box-sizing: border-box;">arr</span><span class="p" style="box-sizing: border-box;">[:</span><span class="o" style="box-sizing: border-box; color: #666666;">-</span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">]</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[7]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">2.4 Utilisez <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">arr</span></code> comme défini en 2.3. Excluez le dernier élément de la liste, mais ne sélectionnez maintenant qu’un élément sur trois. Rappelez-vous que le troisième indice indique <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">stride</span></code>, s’il est utilisé.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/02_numpy.html#2.4-Use-arr-as-defined-in-2.3.-Exclude-the-last-element-from-the-list,-but-now-only-select-every-3rd-element.-Remember-the-third-index-indicates-stride,-if-used." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<section id="2.4-Use-arr-as-defined-in-2.3.-Exclude-the-last-element-from-the-list,-but-now-only-select-every-3rd-element.-Remember-the-third-index-indicates-stride,-if-used." style="box-sizing: border-box;">
<div style="box-sizing: border-box;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><strong style="box-sizing: border-box;">Astuce: </strong>Le résultat devrait être <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[0,3,6,9,12]</span></code>.</p>
</div>
</section>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;">[8]:</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Remplacez le symbole ? par les expressions et valeurs correctes</span>
<span class="n" style="box-sizing: border-box;">arr</span><span class="p" style="box-sizing: border-box;">[:</span><span class="o" style="box-sizing: border-box; color: #666666;">-</span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">]</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[8]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([ 0, 3, 6, 9, 12])</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">2.5 Vous devrez combiner les comparaisons de tableaux et les opérateurs logiques pour résoudre cette question. Trouvez les valeurs du tableau suivant qui sont supérieures à <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">3</span></code> et inférieures à <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">7</span></code>. Le résultat doit être un tableau booléen.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/02_numpy.html#2.5-You'll-need-to-combine-array-comparisons-and-logical-operators-to-solve-this-one.-Find-out-the-values-in-the-following-array-that-are-greater-than-3-AND-less-than-7.-The-output-should-be-a-boolean-array." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<section id="2.5-You'll-need-to-combine-array-comparisons-and-logical-operators-to-solve-this-one.-Find-out-the-values-in-the-following-array-that-are-greater-than-3-AND-less-than-7.-The-output-should-be-a-boolean-array." style="box-sizing: border-box;">
<div style="box-sizing: border-box;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><strong style="box-sizing: border-box;">Astuce:</strong> Si vous êtes bloqué, relisez la section sur les tableaux booléens.</p>
</div>
</section>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[9]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="box-sizing: border-box;"></span></span><span class="n" style="box-sizing: border-box;">arr</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">array</span><span class="p" style="box-sizing: border-box;">([</span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">5</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">6</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">5</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">7</span><span class="p" style="box-sizing: border-box;">,</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">])</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;">
</span></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># </span><span color="#408080" face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="color: #408080; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"><i><font color="#408080" face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace"><span style="font-size: 12px; white-space: pre;">Utilisez des comparaisons de tableaux (<, >, etc.) et des opérateurs logiques (*, +)<br /></span></font><font color="#408080" face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace"><span style="font-size: 12px; white-space: pre;"># pour trouver où les valeurs sont supérieures à 3 et inférieures à 7.<br /></span></font></i></span></span></pre>
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span class="n" style="box-sizing: border-box;">boolean_array</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">arr</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="o" style="box-sizing: border-box; color: #666666;">></span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">)</span><span class="o" style="box-sizing: border-box; color: #666666;">*</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">arr</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="o" style="box-sizing: border-box; color: #666666;"><</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">7</span><span class="p" style="box-sizing: border-box;">)</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;">
</span></span></pre>
</div>
</div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[10]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">boolean_array</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[10]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([False, False, True, False, True, False, False, True, False,
False])</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">2.6 Utilisez votre tableau booléen de 2.5 pour masquer les valeurs <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">False</span></code> de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">arr</span></code>.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/02_numpy.html#2.6-Use-your-boolean-array-from-2.5-to-mask-the-False-values-from-arr." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<section id="2.6-Use-your-boolean-array-from-2.5-to-mask-the-False-values-from-arr." style="box-sizing: border-box;">
<div style="box-sizing: border-box;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><strong style="box-sizing: border-box;">Astuce:</strong> Le résultat devrait être <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[5,</span> <span class="pre" style="box-sizing: border-box;">6,</span> <span class="pre" style="box-sizing: border-box;">5]</span></code>.</p>
</div>
</section>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[11]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Utilisez votre tableau boolean_array résultant de 2.5</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># pour masquer arr tel que défini en 2.5</span>
<span class="n" style="box-sizing: border-box;">arr</span><span class="p" style="box-sizing: border-box;">[</span><span class="n" style="box-sizing: border-box;">boolean_array</span><span class="p" style="box-sizing: border-box;">]</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[11]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([5, 6, 5])</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@0324749a5efc4af986b0f61d1af4ec54" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@851c9e14fac747328cfb3fecfe1d68d8">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@851c9e14fac747328cfb3fecfe1d68d8" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[12]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="o" style="box-sizing: border-box; color: #666666;">%</span><span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">matplotlib</span> inline
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">numpy</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">np</span>
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">from</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">matplotlib</span> <span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="n" style="box-sizing: border-box;">pyplot</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="n" style="box-sizing: border-box;">plt</span>
<span class="n" style="box-sizing: border-box;">im</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">copy</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imread</span><span class="p" style="box-sizing: border-box;">(</span><span class="s1" style="box-sizing: border-box; color: #ba2121;">'Guinea_Bissau.JPG'</span><span class="p" style="box-sizing: border-box;">))</span>
</pre>
</div>
</div>
</div>
<section id="3.1-Let's-use-the-indexing-functionality-of-numpy-to-select-a-portion-of-this-image.-Select-the-top-right-corner-of-this-image-with-shape-(200,200)." style="box-sizing: border-box;">
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">3.1 Utilisons la fonctionnalité d’indexation de numpy pour sélectionner une partie de cette image. Sélectionnez le coin supérieur droit de cette image avec la forme <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">(200,200)</span></code>.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/03_matplotlib.html#3.1-Let's-use-the-indexing-functionality-of-numpy-to-select-a-portion-of-this-image.-Select-the-top-right-corner-of-this-image-with-shape-(200,200)." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<section id="3.1-Let's-use-the-indexing-functionality-of-numpy-to-select-a-portion-of-this-image.-Select-the-top-right-corner-of-this-image-with-shape-(200,200)." style="box-sizing: border-box;">
<div style="box-sizing: border-box; text-align: left;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><b>Astuce: </b>Rappelez-vous qu’il y a trois dimensions dans cette image. Les deux points séparent les portées, et les virgules les dimensions.</p>
</div>
</section>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[13]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Les deux options ci-dessous sont correctes</span>
<span class="n" style="box-sizing: border-box;">topright</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">im</span><span class="p" style="box-sizing: border-box;">[:</span><span class="mi" style="box-sizing: border-box; color: #666666;">200</span><span class="p" style="box-sizing: border-box;">,</span> <span class="o" style="box-sizing: border-box; color: #666666;">-</span><span class="mi" style="box-sizing: border-box; color: #666666;">200</span><span class="p" style="box-sizing: border-box;">:,</span> <span class="p" style="box-sizing: border-box;">]</span>
<span class="n" style="box-sizing: border-box;">topright</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">im</span><span class="p" style="box-sizing: border-box;">[:</span><span class="mi" style="box-sizing: border-box; color: #666666;">200</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">400</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">600</span><span class="p" style="box-sizing: border-box;">,</span> <span class="p" style="box-sizing: border-box;">]</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Affichez votre résultat en utilisant imshow</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">topright</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[13]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08e28f7940>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_27_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_27_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">3.2 Regardons l’un des pixels de cette image. Nous choisissons le coin supérieur gauche avec la position <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">(0,0)</span></code> et montrons les valeurs de ses canaux RVB.</h3>
<section id="3.2-Let's-have-a-look-at-one-of-the-pixels-in-this-image.-We-choose-the-top-left-corner-with-position-(0,0)-and-show-the-values-of-its-RGB-channels." style="box-sizing: border-box; color: #000000; font-family: Arial, sans-serif;">
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[14]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px; text-align: left;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Exécutez cette cellule pour voir les valeurs des canaux de couleur</span>
<span class="n" style="box-sizing: border-box;">im</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">0</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">0</span><span class="p" style="box-sizing: border-box;">]</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none; text-align: left;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[14]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">array([249, 196, 104], dtype=uint8)</pre>
</div>
</div>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">La première valeur correspond à la composante rouge, la deuxième à la composante verte et la troisième à la composante bleue. <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">uint8</span></code> peut contenir des valeurs dans la plage <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[0-255]</span></code> donc le pixel a beaucoup de rouge, un peu de vert, et peu de bleu. Ce pixel est d’une couleur sableuse jaune orangé.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><span face="Arial, sans-serif">Maintenant, nous allons modifier l’image.</span></p>
</section>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">3.3 Que se passe-t-il si nous fixons toutes les valeurs représentant le canal bleu à la valeur maximale ?</h3>
<section id="What-happens-if-we-set-all-the-values-representing-the-blue-channel-to-the-maximum-value?" style="box-sizing: border-box; color: #000000; font-family: Arial, sans-serif;">
<div style="box-sizing: border-box;">
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[15]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px; text-align: left;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Exécutez cette cellule pour définir toutes les valeurs du bande bleu sur 255</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># On fait d'abord une copie pour éviter de modifier l'image d'origine</span>
<span class="n" style="box-sizing: border-box;">im2</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">copy</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">im</span><span class="p" style="box-sizing: border-box;">)</span>
<span class="n" style="box-sizing: border-box;">im2</span><span class="p" style="box-sizing: border-box;">[:,:,</span><span class="mi" style="box-sizing: border-box; color: #666666;">2</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="mi" style="box-sizing: border-box; color: #666666;">255</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">im2</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[15]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08e23d0ac8>
</pre>
</div>
</div>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"></p>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px; text-align: left;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_32_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_32_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><span style="color: #000000; font-family: Arial, sans-serif; font-size: 16px;">La notation de l’index <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[:,:,2]</span></code> </span><span face="Arial, sans-serif">sélectionne les pixels de toutes les hauteurs et de toutes les largeurs, mais uniquement le troisième bande de couleur.</span></p>
</div>
</section>
<section id="Can-you-modify-the-above-code-cell-to-set-all-red-values-to-the-maximum-value-of-255?" style="box-sizing: border-box; color: #000000; font-family: Arial, sans-serif;"></section>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">3.4 Pouvez-vous modifier la cellule de code ci-dessus pour fixer toutes les valeurs rouges à la valeur maximale de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">255</span></code>?</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[16]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid rgb(224, 224, 224); border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">im2</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">copy</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">im</span><span class="p" style="box-sizing: border-box;">)</span>
<span class="n" style="box-sizing: border-box;">im2</span><span class="p" style="box-sizing: border-box;">[:,:,</span><span class="mi" style="box-sizing: border-box; color: #666666;">0</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="mi" style="box-sizing: border-box; color: #666666;">255</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">im2</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[16]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08e0b34ef0>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_35_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_35_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px; float: left;" /></div>
</div>
</section>
<section id="Can-you-modify-the-above-code-cell-to-set-all-red-values-to-the-maximum-value-of-255?" style="box-sizing: border-box; color: #000000; font-family: Arial, sans-serif;">
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"></pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;"></div>
</section>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@87bf5080127e470c81dfc283685514b8" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@97abbc31b08a4fe094e01332b94e9dec">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@97abbc31b08a4fe094e01332b94e9dec" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px; text-align: left;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[17]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px; text-align: left;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="o" style="box-sizing: border-box; color: #666666;">%</span><span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">matplotlib</span> inline
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">numpy</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">np</span>
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">from</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">matplotlib</span> <span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="n" style="box-sizing: border-box;">pyplot</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="n" style="box-sizing: border-box;">plt</span>
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">from</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">matplotlib</span> <span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="n" style="box-sizing: border-box;">colors</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># grass = 1</span>
<span class="n" style="box-sizing: border-box;">area</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">ones</span><span class="p" style="box-sizing: border-box;">((</span><span class="mi" style="box-sizing: border-box; color: #666666;">100</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">100</span><span class="p" style="box-sizing: border-box;">))</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># crops = 2</span>
<span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">10</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">60</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">20</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">50</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="mi" style="box-sizing: border-box; color: #666666;">2</span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># city = 3</span>
<span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">70</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">90</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">60</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">80</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="mi" style="box-sizing: border-box; color: #666666;">3</span>
<span class="n" style="box-sizing: border-box;">index</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="p" style="box-sizing: border-box;">{</span><span class="mi" style="box-sizing: border-box; color: #666666;">1</span><span class="p" style="box-sizing: border-box;">:</span> <span class="s1" style="box-sizing: border-box; color: #ba2121;">'green'</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">2</span><span class="p" style="box-sizing: border-box;">:</span> <span class="s1" style="box-sizing: border-box; color: #ba2121;">'yellow'</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">3</span><span class="p" style="box-sizing: border-box;">:</span> <span class="s1" style="box-sizing: border-box; color: #ba2121;">'grey'</span><span class="p" style="box-sizing: border-box;">}</span>
<span class="n" style="box-sizing: border-box;">cmap</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">colors</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">ListedColormap</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">index</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">values</span><span class="p" style="box-sizing: border-box;">())</span>
</pre>
</div>
</div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">4.1 La saison des récoltes est arrivée et nos terres cultivées ont changé de couleur pour devenir brunes. Pouvez-vous :<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/04_cleaning_data.html#4.1-The-harvesting-season-has-arrived-and-our-cropping-lands-have-changed-colour-to-brown.-Can-you:" title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<h4 style="box-sizing: border-box; font-size: 18.4px; color: #336699;">4.1.1 Modifiez la zone jaune pour contenir la nouvelle valeur <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 13.8px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">4</span></code>?<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/04_cleaning_data.html#4.1.1-Modify-the-yellow-area-to-contain-the-new-value-4?" title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h4>
<section id="4.1-The-harvesting-season-has-arrived-and-our-cropping-lands-have-changed-colour-to-brown.-Can-you:" style="box-sizing: border-box;">
<section id="4.1.1-Modify-the-yellow-area-to-contain-the-new-value-4?" style="box-sizing: border-box;"></section>
</section>
<h4 style="box-sizing: border-box; font-size: 18.4px; color: #336699;">4.1.2 Ajoutez une nouvelle entrée au dictionnaire <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 13.8px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">index</span></code> den associant le numéro <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 13.8px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">4</span></code> à la valeur <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 13.8px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">brown</span></code>.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/04_cleaning_data.html#4.1.2-Add-a-new-entry-to-the-index-dictionary-mapping-number-4-to-the-value-brown." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h4>
<section style="box-sizing: border-box;">
<section id="4.1.2-Add-a-new-entry-to-the-index-dictionary-mapping-number-4-to-the-value-brown." style="box-sizing: border-box;"></section>
</section>
<h4 style="box-sizing: border-box; font-size: 18.4px; color: #336699;">4.1.3 Affichez la zone.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/04_cleaning_data.html#4.1.3-Plot-the-area." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h4>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[18]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="box-sizing: border-box;"></span></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># 4.1.1 </span><span color="#408080" face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="color: #408080; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"><i>Modifiez la zone jaune pour garder la valeur 4
</i></span></span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;">
</span></span><span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">10</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">60</span><span class="p" style="box-sizing: border-box;">,</span><span class="mi" style="box-sizing: border-box; color: #666666;">20</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">50</span><span class="p" style="box-sizing: border-box;">]</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;"> </span></span><span class="mi" style="box-sizing: border-box; color: #666666;">4</span><span face="SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace;"><span style="font-size: 12px; white-space: pre;">
</span></span></pre>
</div>
</div>
</div>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[19]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># 4.1.2 Ajouter une nouvelle paire clé-valeur à l'index qui convertit 4 en 'brown'</span>
<span class="n" style="box-sizing: border-box;">index</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">4</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="s1" style="box-sizing: border-box; color: #ba2121;">'brown'</span>
</pre>
</div>
</div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[20]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># 4.1.3 Copiez la définition de cmap et réexécutez-la pour ajouter la nouvelle couleur</span>
<span class="n" style="box-sizing: border-box;">cmap</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">colors</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">ListedColormap</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">index</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">values</span><span class="p" style="box-sizing: border-box;">())<br /></span>
<span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Affichez la zone</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">,</span> <span class="n" style="box-sizing: border-box;">cmap</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="n" style="box-sizing: border-box;">cmap</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[20]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08e0b26198>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px; text-align: left;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_41_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_41_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<section style="box-sizing: border-box;">
<section id="4.1.3-Plot-the-area." style="box-sizing: border-box;">
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 16px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><br /><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span></pre>
</div>
</div>
</div>
<div style="box-sizing: border-box;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><strong style="box-sizing: border-box;">Astuce:</strong> Si vous voulez afficher la nouvelle zone, vous devez redéfinir <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">cmap</span></code> pour que la nouvelle valeur se voit attribuer une couleur dans la carte des couleurs. Copiez et collez la ligne <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">cmap</span> <span class="pre" style="box-sizing: border-box;">=</span> <span class="pre" style="box-sizing: border-box;">...</span></code> du tracé original.</p>
</div>
</section>
</section>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">4.2 Définissez zone <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">area[20:40,</span> <span class="pre" style="box-sizing: border-box;">80:95]</span> <span class="pre" style="box-sizing: border-box;">=</span> <span class="pre" style="box-sizing: border-box;">np.nan</span></code>. Tracez la zone maintenant.<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/04_cleaning_data.html#4.2-Set-area[20:40,-80:95]-=-np.nan.-Plot-the-area-now." title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[21]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Définissez la zone nan</span>
<span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">[</span><span class="mi" style="box-sizing: border-box; color: #666666;">20</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">40</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">80</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: #666666;">95</span><span class="p" style="box-sizing: border-box;">]</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">nan</span>
</pre>
</div>
</div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[22]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Affichez toute la zone</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">,</span> <span class="n" style="box-sizing: border-box;">cmap</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="n" style="box-sizing: border-box;">cmap</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[22]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08e0a78e48>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_45_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_45_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">4.3 Trouvez la médiane du tableau <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">area</span></code> de 4.2 en utilisant <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">np.nanmedian</span></code>. Est-ce que cela correspond à votre interprétation visuelle ? Comment cela se compare-t-il à l’utilisation de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">np.median</span></code>?</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[23]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Utilisez np.nanmedian pour trouver la médiane de la zone</span>
<span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">nanmedian</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[23]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">1.0
</pre>
</div>
</div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[24]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">np</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">median</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">area</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px; text-align: left;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[24]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">nan</pre>
</div>
</div>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">np.median</span></code><span style="color: #3c3c3c; font-size: 16px; font-weight: 400;"> </span>renvoie une valeur de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">nan</span></code><span> </span>car il ne peut pas interpréter les pixels sans données. <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">np.nanmedian</span></code><span> </span><span style="font-size: 1em;">exclut les valeurs NaN, il renvoie donc une valeur de </span><code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">1</span></code><span> </span><span style="font-size: 1em;">qui indique la couverture herbeuse. Cela correspond à l'affichage de <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">area</span></code>.</span></p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@vertical+block@c9f09ef16cfa4fefadd39fe0c04391cf" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@6c63610f5d0a4f6da8a0266ebe282abe">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101-fr+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101-fr+2021+type@html+block@6c63610f5d0a4f6da8a0266ebe282abe" data-request-token="69214126035611ef8255fd390e3a51ef" data-graded="False" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p></p>
<div class="nbinput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-top: 5px; padding-bottom: 5px; color: #000000; font-family: Arial, sans-serif;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[25]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="o" style="box-sizing: border-box; color: #666666;">%</span><span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">matplotlib</span> inline
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">numpy</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">np</span>
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">from</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">matplotlib</span> <span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="n" style="box-sizing: border-box;">pyplot</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="n" style="box-sizing: border-box;">plt</span>
<span class="kn" style="box-sizing: border-box; color: #008000; font-weight: bold;">import</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">xarray</span> <span class="k" style="box-sizing: border-box; color: #008000; font-weight: bold;">as</span> <span class="nn" style="box-sizing: border-box; color: #0000ff; font-weight: bold;">xr</span>
<span class="n" style="box-sizing: border-box;">guinea_bissau</span> <span class="o" style="box-sizing: border-box; color: #666666;">=</span> <span class="n" style="box-sizing: border-box;">xr</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">open_dataset</span><span class="p" style="box-sizing: border-box;">(</span><span class="s1" style="box-sizing: border-box; color: #ba2121;">'guinea_bissau.nc'</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<section id="5.1-Can-you-access-to-the-crs-value-in-the-attributes-of-the-guinea_bissau-xarray.Dataset?" style="box-sizing: border-box; color: #000000;">
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">5.1 Pouvez-vous accéder à la valeur <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">crs</span></code> dans les attributs du <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">guinea_bissau</span></code> <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">xarray.Dataset</span></code>?<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/05_xarray.html#5.1-Can-you-access-to-the-crs-value-in-the-attributes-of-the-guinea_bissau-xarray.Dataset?" title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<section id="5.1-Can-you-access-to-the-crs-value-in-the-attributes-of-the-guinea_bissau-xarray.Dataset?" style="box-sizing: border-box; color: #000000;">
<p style="box-sizing: border-box; text-align: left;"><b>Astuce: </b>Vous pouvez faire appel aux « attributs » de la même manière que vous sélectionnerez une « variable » ou une « coordonnée ».</p>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[26]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Remplace le ? avec le nom de l'attribut</span>
<span class="n" style="box-sizing: border-box;">guinea_bissau</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">crs</span>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[26]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;">'EPSG:32628'</pre>
</div>
</div>
</div>
</section>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">5.2 Sélectionnez la région de la variable <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">blue</span></code> délimitée par ces coordonnées :<a class="headerlink" href="https://training.digitalearthafrica.org/en/latest/python_basics/05_xarray.html#5.2-Select-the-region-of-the-blue-variable-delimited-by-these-coordinates:" title="Permalink to this headline" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer; display: inline-block; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: normal; font-stretch: normal; line-height: 1; font-family: inherit; font-size: 14px; text-rendering: auto; -webkit-font-smoothing: antialiased; visibility: hidden;"></a></h3>
<ul style="font-size: 16px; font-weight: 400;">
<li><span>latitude de l’intervalle [1335000, 1329030]</span></li>
<li><span>longitude de la plage [389520, 395490]</span></li>
</ul>
<div style="box-sizing: border-box; text-align: left;">
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><strong style="box-sizing: border-box;">Astuce :</strong> Voulons-nous utiliser <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">sel()</span></code> ou <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">isel()</span></code>? Quelle est la coordonnée <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">x</span></code> et quelle est la coordonnée <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">y</span></code>?</p>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699;">5.3 Tracez la région sélectionnée en utilisant <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">imshow</span></code>, puis tracez la région en utilisant <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">.plot()</span></code>.</h3>
<section id="Can-you-change-the-colour-map-to-'Blues'?" style="box-sizing: border-box; color: #000000; font-family: Arial, sans-serif;"></section>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[27]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Affichez en utilisant plt.imshow</span>
<span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">guinea_bissau</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">blue</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">sel</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">x</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">389520</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">395490</span><span class="p" style="box-sizing: border-box;">),</span> <span class="n" style="box-sizing: border-box;">y</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">1335000</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">1329030</span><span class="p" style="box-sizing: border-box;">)))</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[27]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08cb8f0da0>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_58_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_58_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[28]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="c1" style="box-sizing: border-box; color: #408080; font-style: italic;"># Affichez en utilisant .plot()</span>
<span class="n" style="box-sizing: border-box;">guinea_bissau</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">blue</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">sel</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">x</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">389520</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">395490</span><span class="p" style="box-sizing: border-box;">),</span> <span class="n" style="box-sizing: border-box;">y</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">1335000</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">1329030</span><span class="p" style="box-sizing: border-box;">))</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">plot</span><span class="p" style="box-sizing: border-box;">()</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[28]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.collections.QuadMesh at 0x7f08cb824898>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_59_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_59_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<h3 style="box-sizing: border-box; margin-top: 0px; font-weight: bold; font-size: 20px; color: #336699; text-align: left;">5.4 Pouvez-vous changer la carte des couleurs en <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 15px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">'Blues'</span></code> ?</h3>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;">[29]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">plt</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">imshow</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">guinea_bissau</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">blue</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">sel</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">x</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">389520</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">395490</span><span class="p" style="box-sizing: border-box;">),</span> <span class="n" style="box-sizing: border-box;">y</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">1335000</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">1329030</span><span class="p" style="box-sizing: border-box;">)),</span> <span class="n" style="box-sizing: border-box;">cmap</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="s1" style="box-sizing: border-box; color: #ba2121;">'Blues'</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[29]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.image.AxesImage at 0x7f08cb763eb8>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_61_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_61_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
<div class="nbinput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: -19px 0px 0px; width: 696.469px; padding-top: 5px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #307fc1;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[30]:
</pre>
</div>
</div>
<div class="input_area highlight-ipython3 notranslate" style="box-sizing: border-box; margin: 0px; flex: 1 1 0%; overflow: auto; border: 1px solid #e0e0e0; border-radius: 2px;">
<div class="highlight" style="box-sizing: border-box; background: #f8f8f8; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: 1.4; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">guinea_bissau</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">blue</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">sel</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">x</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">389520</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">395490</span><span class="p" style="box-sizing: border-box;">),</span> <span class="n" style="box-sizing: border-box;">y</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="nb" style="box-sizing: border-box; color: #008000;">slice</span><span class="p" style="box-sizing: border-box;">(</span><span class="mi" style="box-sizing: border-box; color: #666666;">1335000</span><span class="p" style="box-sizing: border-box;">,</span> <span class="mi" style="box-sizing: border-box; color: #666666;">1329030</span><span class="p" style="box-sizing: border-box;">))</span><span class="o" style="box-sizing: border-box; color: #666666;">.</span><span class="n" style="box-sizing: border-box;">plot</span><span class="p" style="box-sizing: border-box;">(</span><span class="n" style="box-sizing: border-box;">cmap</span><span class="o" style="box-sizing: border-box; color: #666666;">=</span><span class="s1" style="box-sizing: border-box; color: #ba2121;">'Blues'</span><span class="p" style="box-sizing: border-box;">)</span>
</pre>
</div>
</div>
</div>
<div class="nboutput docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px; width: 696.469px;">
<div class="prompt highlight-none notranslate" style="box-sizing: border-box; margin: 0px; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;">
<div class="highlight" style="box-sizing: border-box; background: none; border: none; overflow-x: auto; margin: 0px 0.3ex 0px 0px; padding: 0px; box-shadow: none; position: absolute; right: 0px;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow: hidden; border: none; box-shadow: none; background: none; color: #bf5b3d;"><span style="box-sizing: border-box; border: none; padding: 0px; margin: 0px; box-shadow: none; background: none;"></span>[30]:
</pre>
</div>
</div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;">
<div class="highlight" style="box-sizing: border-box; background: unset; border: none; overflow: auto hidden; margin: 0px; padding: 0px; box-shadow: none; color: unset;">
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: pre; line-height: normal; margin-top: 0px; margin-bottom: 0px; padding: 5px; overflow: auto; border: none; box-shadow: none; background: unset;"><matplotlib.collections.QuadMesh at 0x7f08cb6d1710>
</pre>
</div>
</div>
</div>
<div class="nboutput nblast docutils container" style="box-sizing: border-box; display: flex; align-items: flex-start; margin: 0px 0px 19px; width: 696.469px; padding-bottom: 5px;">
<div class="prompt empty docutils container" style="box-sizing: border-box; width: 4.5ex; padding-top: 5px; position: relative; user-select: none;"></div>
<div class="output_area docutils container" style="box-sizing: border-box; flex: 1 1 0%; overflow: auto;"><img alt="../_images/python_basics_06_python_solutions_62_1.png" src="https://training.digitalearthafrica.org/en/latest/_images/python_basics_06_python_solutions_62_1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; padding: 5px; margin: 0px;" /></div>
</div>
</section>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>