Re: [Qgis-user] Write vector attribute table from pandas dataframe

2022-04-25 Thread ming han via Qgis-user
Thanks, Wouter and Nicolas

I will give it a try.

Cheers
Ming

On Sun, Apr 24, 2022 at 9:33 AM Wouter Impens via Qgis-user <
qgis-user@lists.osgeo.org> wrote:

> Hi,
>
> If you have a field to join on, you could export the dataframe to
> something that is readable in QGIS like csv or xlsx
>
> Greetings
> Wouter
>
> Op za 23 apr. 2022 om 19:34 schreef Nicolas Cadieux via Qgis-user <
> qgis-user@lists.osgeo.org>:
>
>> Hi Ming,
>>
>> The best thing would be to show your code and ask others how it can be
>> optimized.  I find that https://gis.stackexchange.com/ 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.
>>
>>
>> https://medium.com/analytics-vidhya/understanding-vectorization-in-numpy-and-pandas-188b6ebc5398
>>
>> 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.
>>
>> Hope this helps
>>
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>>
>> Le 22 avr. 2022 à 11:50, ming han via Qgis-user <
>> qgis-user@lists.osgeo.org> a écrit :
>>
>> 
>> Hi everyone
>>
>>  Is there an efficient way to copy data in a pandas dataframe to the
>> vector attribute table?
>>
>>   I am looping element by element, which is very slow.
>>
>> Thanks
>> Ming
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Write vector attribute table from pandas dataframe

2022-04-24 Thread Wouter Impens via Qgis-user
Hi,

If you have a field to join on, you could export the dataframe to something
that is readable in QGIS like csv or xlsx

Greetings
Wouter

Op za 23 apr. 2022 om 19:34 schreef Nicolas Cadieux via Qgis-user <
qgis-user@lists.osgeo.org>:

> Hi Ming,
>
> The best thing would be to show your code and ask others how it can be
> optimized.  I find that https://gis.stackexchange.com/ 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.
>
>
> https://medium.com/analytics-vidhya/understanding-vectorization-in-numpy-and-pandas-188b6ebc5398
>
> 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.
>
> Hope this helps
>
> Nicolas Cadieux
> https://gitlab.com/njacadieux
>
> Le 22 avr. 2022 à 11:50, ming han via Qgis-user 
> a écrit :
>
> 
> Hi everyone
>
>  Is there an efficient way to copy data in a pandas dataframe to the
> vector attribute table?
>
>   I am looping element by element, which is very slow.
>
> Thanks
> Ming
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Write vector attribute table from pandas dataframe

2022-04-23 Thread Nicolas Cadieux via Qgis-user
Hi Ming,

The best thing would be to show your code and ask others how it can be 
optimized.  I find that https://gis.stackexchange.com/ 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.  

https://medium.com/analytics-vidhya/understanding-vectorization-in-numpy-and-pandas-188b6ebc5398

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.  

Hope this helps

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 22 avr. 2022 à 11:50, ming han via Qgis-user  a 
> écrit :
> 
> 
> Hi everyone 
> 
>  Is there an efficient way to copy data in a pandas dataframe to the 
> vector attribute table? 
> 
>   I am looping element by element, which is very slow. 
> 
> Thanks
> Ming 
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user