<div dir="ltr">Thanks, Wouter and Nicolas <div><br></div><div> I will give it a try. </div><div><br></div><div>Cheers</div><div>Ming </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 24, 2022 at 9:33 AM Wouter Impens via Qgis-user <<a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>If you have a field to join on, you could export the dataframe to something that is readable in QGIS like csv or xlsx</div><div><br></div><div>Greetings</div><div>Wouter</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op za 23 apr. 2022 om 19:34 schreef Nicolas Cadieux via Qgis-user <<a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi Ming,<div><br><div>The best thing would be to show your code and ask others how it can be optimized. I find that <a href="https://gis.stackexchange.com/" target="_blank">https://gis.stackexchange.com/</a> is the best place to do this but this user list definitely has some very competent programmers. Not being one of those competent programmers, I will just state that pandas and geopandas use a process called vectorization where the “for loop” is done for you. <br><div><br></div><div><a href="https://medium.com/analytics-vidhya/understanding-vectorization-in-numpy-and-pandas-188b6ebc5398" target="_blank">https://medium.com/analytics-vidhya/understanding-vectorization-in-numpy-and-pandas-188b6ebc5398</a><br><br>This means that looping over elements in a dataframe can be MUCH slower than using vectorization. So basically, you need to figure out the right code and avoid “for loops“ when using dataframes. </div><div><br></div><div>Hope this helps<br><br><div dir="ltr">Nicolas Cadieux<div><a href="https://gitlab.com/njacadieux" target="_blank">https://gitlab.com/njacadieux</a></div></div><div dir="ltr"><br><blockquote type="cite">Le 22 avr. 2022 à 11:50, ming han via Qgis-user <<a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a>> a écrit :<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">Hi everyone <div><br></div><div> Is there an efficient way to copy data in a pandas dataframe to the vector attribute table? </div><div><br></div><div> I am looping element by element, which is very slow. </div><div><br></div><div>Thanks</div><div>Ming </div></div>
<span>_______________________________________________</span><br><span>Qgis-user mailing list</span><br><span><a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a></span><br><span>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span><br><span>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span><br></div></blockquote></div></div></div></div>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div>