Recursive query in pandas dataframe python

preview_player
Показать описание
Pandas dataframe don't support recursive query by default. But this video will teach you, how to do SQL recursive query in python dataframe.
Output generated is of bread crumb.
This can also be said as parent child hierarchical query.

This can be said as SQL CTE, alternative.
Рекомендации по теме
Комментарии
Автор

Thank you!, eventhough you published this video two years ago, there is still almost anything about this kind of solution on the Internet, your code worked perfect for my needs, I only made a few adjustments. Thank you so much

fiercepower
Автор

exactly ..even in pyspark ...i wrote anyhow.. cre doesnt worka in databrick /spark sql and given exanples are falses

kunnunhs
Автор

I have a requirement, can you guide, I have 3 columns in a xls, 1st column, code, 2nd column is code description, 3rd column is parent code. This is to get data in hierarchy. I would like to sort the records like parents would be first and then their child's.Can you guide

SankarJankoti
Автор

Would you please share link to your code

jyorko
Автор

it will be great if you can share with us your data...

nickwu
join shbcf.ru