<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body 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/">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">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">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 <qgis-user@lists.osgeo.org> 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>Qgis-user@lists.osgeo.org</span><br><span>List info: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br><span>Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br></div></blockquote></div></div></div></body></html>