home.social

#pandas — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #pandas, aggregated by home.social.

fetched live
  1. Want rows in a data frame that might have several values? Another way (besides the | I showed yesterday) is the "isin" method:

    (
    df
    .loc[ pd.col('passenger_count').isin([5, 7]) ]
    )

    We'll compare isin vs. | speed tomorrow. But I find this far more readable.

  2. Want rows in a #Python #Pandas data frame that might have several values? Another way (besides the | I showed yesterday) is the "isin" method:

    (
    df
    .loc[ pd.col('passenger_count').isin([5, 7]) ]
    )

    We'll compare isin vs. | speed tomorrow. But I find this far more readable.

  3. Want rows in a data frame that might have several values? You can use the | operator, but be sure to use () to avoid precedence issues:

    (
    df
    .loc[((pd.col('passenger_count') == 5) |
    (pd.col('passenger_count') == 7))]
    )

  4. Want rows in a #Python #Pandas data frame that might have several values? You can use the | operator, but be sure to use () to avoid precedence issues:

    (
    df
    .loc[((pd.col('passenger_count') == 5) |
    (pd.col('passenger_count') == 7))]
    )

  5. Шиномонтаж методом Симпсона: как красивая статистика чуть не убила премиум-сервис

    Что делать, если средний чек премиального автосервиса оказался в 4 раза меньше планового? Первое «очевидное» решение руководства — немедленно избавиться от дешёвой мелочёвки вроде сезонного шиномонтажа и хранения колес, которая перегружает мастеров и портит красивую статистику. Звучит логично? Абсолютно. Вот только глубокий дата-анализ показал, что такое «оптимизаторское» решение лишило бы компанию доброй трети валовой выручки. В этой статье мы разбираем реальный кейс анализа массива из сотен тысяч заказов за 10 лет работы крупного автодилера. Разберем обработку данных в Python (Pandas/Seaborn), столкнемся с Парадоксом Симпсона в действии и рассчитаем честный LTV клиентов. Вы узнаете, как сезонная переобувка работает в роли «троянского коня» и почему клиенты с шиномонтажом за свой жизненный цикл приносят компании в 3.1 раза больше денег.

    habr.com/ru/articles/1066368/

    #анализ_данных #python #pandas #ltv #бизнесанализ #продуктовая_аналитика #визуализация_данных #сегментация_клиентов #парадокс_симпсона

  6. Stacking loc to filter a dataframe? Order can matter:

    (
    df
    .loc[ pd.col('total_amount') > 25 ]
    .loc[ pd.col('passenger_count') > 0 ]
    ) # 64.5 ms

    (
    df
    .loc[ pd.col('passenger_count') > 0 ]
    .loc[ pd.col('total_amount') > 25 ]
    ) # 95.8 ms -- 30% slower

  7. Stacking loc to filter a #Python #Pandas dataframe? Order can matter:

    (
    df
    .loc[ pd.col('total_amount') > 25 ]
    .loc[ pd.col('passenger_count') > 0 ]
    ) # 64.5 ms

    (
    df
    .loc[ pd.col('passenger_count') > 0 ]
    .loc[ pd.col('total_amount') > 25 ]
    ) # 95.8 ms -- 30% slower

  8. Filtering rows in a data frame? Use .loc:

    (
    df
    .loc[ pd.col('passenger_count') > 1 ]
    )

    pd.col refers to the previous line's returned data frame. So we can stack them:

    (
    df
    .loc[ pd.col('passenger_count') > 1 ]
    .loc[ pd.col('total_amount') > 50 ]
    )

  9. Filtering rows in a #Python #Pandas data frame? Use .loc:

    (
    df
    .loc[ pd.col('passenger_count') > 1 ]
    )

    pd.col refers to the previous line's returned data frame. So we can stack them:

    (
    df
    .loc[ pd.col('passenger_count') > 1 ]
    .loc[ pd.col('total_amount') > 50 ]
    )

  10. 📢 In case you missed it: "Not an island: bringing compression to the tabular ecosystem".

    Most compression libraries ask you to move in — learn their API, convert your data, leave your tools behind. We think that's backwards: compression should be a fast, compact layer *underneath* the tools you already use.

    Blosc2 4.9.1: DuckDB, Polars, PyArrow and pandas 3 read a CTable directly via Arrow's PyCapsule protocol.

    📖 blosc.org/posts/not-an-island-

    #Arrow #DuckDB #Pandas #Compression #OpenSource

  11. #pandas (the software) should be forbidden. I will not elaborate.

  12. We just finished another day at in Krakow. But the fun keeps coming -- either at a social event, or using to analyze Krakow tourism data from the Polish government!

    Level up your data-analysis skills every Wednesday: BambooWeekly.com

  13. We just finished another day at #EuroPython2026 in Krakow. But the fun keeps coming -- either at a social event, or using #Python #Pandas to analyze Krakow tourism data from the Polish government!

    Level up your data-analysis skills every Wednesday: BambooWeekly.com

  14. I'm in Krakow for , and as such, Bamboo Weekly is about tourism to Krakow. Get data from the Polish government, and answer data-analysis questions with !

    More info: BambooWeekly.com

  15. I'm in Krakow for #EuroPython, and as such, Bamboo Weekly is about tourism to Krakow. Get data from the Polish government, and answer data-analysis questions with #Python #Pandas!

    More info: BambooWeekly.com

  16. #NVIDIA published a blog post where they present GQE, a GPU-based query engine. Querying data from databases with GPU accelleration is beyond cool, and will certainly optimize the storage requirements for #bigdata due to enabling for more efficient compression algorithms. Here is the blog post:

    Designing GPU-Accelerated Query Engines with NVIDIA GQE

    #bigdata #databases #polars #pandas #datascience

  17. #NVIDIA published a blog post where they present GQE, a GPU-based query engine. Querying data from databases with GPU accelleration is beyond cool, and will certainly optimize the storage requirements for #bigdata due to enabling for more efficient compression algorithms. Here is the blog post:

    Designing GPU-Accelerated Query Engines with NVIDIA GQE

    #bigdata #databases #polars #pandas #datascience

  18. Europe has been pretty hot lately -- and in the latest Bamboo Weekly, we used , GeoPandas, Marimo, and Plotly to find out just *how* hot.

    Every week, get better at data analysis: BambooWeekly.com

  19. Europe has been pretty hot lately -- and in the latest Bamboo Weekly, we used #Python #Pandas, GeoPandas, Marimo, and Plotly to find out just *how* hot.

    Every week, get better at data analysis: BambooWeekly.com

  20. Europe has been very hot for the last few weeks. How hot? In the latest Bamboo Weekly, we use to find out, using APIs and GeoPandas. Plus, we use Marimo for interactive plots.

    Level up your data skills at BambooWeekly.com ... and stay cool!

  21. Europe has been very hot for the last few weeks. How hot? In the latest Bamboo Weekly, we use #Python #Pandas to find out, using APIs and GeoPandas. Plus, we use Marimo for interactive plots.

    Level up your data skills at BambooWeekly.com ... and stay cool!

  22. #AIP:
    "
    ".. extrem lichtschwache Zwerggalaxie wurde in der Nähe der Andromedagalaxie (M31) erstmals beobachtet. .. Studie legt nahe, dass die Galaxie, benannt And XXXVI, eine der lichtschwächsten Satellitengalaxien im Umfeld von Andromeda ist. ..
    "
    ".. Alter von etwa 12,5 Milliarden Jahren .. erstaunlich arm an schweren Elementen .."

    aip.de/de/news/galaxy-around-a

    29.6.2026

    #Andromeda #AndXXXVI #Astronomie #DM #DunkleMaterie #Galaxie #GTC #Kosmologie #PAndAS #Standardmodell #Universum #Zwerggalaxie

  23. #AIP:
    "
    ".. extrem lichtschwache Zwerggalaxie wurde in der Nähe der Andromedagalaxie (M31) erstmals beobachtet. .. Studie legt nahe, dass die Galaxie, benannt And XXXVI, eine der lichtschwächsten Satellitengalaxien im Umfeld von Andromeda ist. ..
    "
    ".. Alter von etwa 12,5 Milliarden Jahren .. erstaunlich arm an schweren Elementen .."

    aip.de/de/news/galaxy-around-a

    29.6.2026

    #Andromeda #AndXXXVI #Astronomie #DM #DunkleMaterie #Galaxie #GTC #Kosmologie #PAndAS #Standardmodell #Universum #Zwerggalaxie

  24. Trying to use .loc to retrieve a slice in ? If the index repeats, you need to sort it:

    s = Series([10, 20, 30], index=list('aba'))

    s.loc['a':'b'] # KeyError: "Cannot get left slice bound for non-unique label: 'a'"

    s.sort_index().loc['a':'b'] # works!

  25. Trying to use .loc to retrieve a slice in #Python #Pandas? If the index repeats, you need to sort it:

    s = Series([10, 20, 30], index=list('aba'))

    s.loc['a':'b'] # KeyError: "Cannot get left slice bound for non-unique label: 'a'"

    s.sort_index().loc['a':'b'] # works!

  26. Retrieve from a data frame with .loc, which takes 2 arguments:

    1. Row selector: index, list of indexes, or a mask index (i.e., booleans)
    2. Optional column selector: column name or a list of column names

    .loc uses [] and not (), so you can use slices!

  27. Retrieve from a #Python #Pandas data frame with .loc, which takes 2 arguments:

    1. Row selector: index, list of indexes, or a mask index (i.e., booleans)
    2. Optional column selector: column name or a list of column names

    .loc uses [] and not (), so you can use slices!

  28. Looking to level up your , , or ?

    My in-browser, interactive AI tutor — used in all LernerPython courses — has you covered.

    This week's new features:

    • Live pair programming
    • Translation of questions into your native language
    • SQL exercises

    Try it (free, no obligation) at buff.ly/zY4k23g

  29. Looking to level up your #Python, #Pandas, or #Git?

    My in-browser, interactive AI tutor — used in all LernerPython courses — has you covered.

    This week's new features:

    • Live pair programming
    • Translation of questions into your native language
    • SQL exercises

    Try it (free, no obligation) at buff.ly/zY4k23g

  30. Which governments restrict religion the most? Members of which religions are harassed the most? And how has this changed over the years?

    In the latest Bamboo Weekly, we use to analyze data from Pew Research.

    Level up your data skills every Wednesday, at buff.ly/D6C2X2C

  31. Which governments restrict religion the most? Members of which religions are harassed the most? And how has this changed over the years?

    In the latest Bamboo Weekly, we use #Python #Pandas to analyze data from Pew Research.

    Level up your data skills every Wednesday, at buff.ly/D6C2X2C

  32. Filtering a data frame by the index? Pandas 3 adds pd.col, removing lambda from our .loc expression.

    Before:

    df.loc[ lambda df_: df_['x'] > df_['w'] ]

    Now:

    df.loc[ pd.col('x') > pd.col('w') ]

    Note: You cannot use pd.col with a series, only a data frame.

  33. Filtering a #Python #Pandas data frame by the index? Pandas 3 adds pd.col, removing lambda from our .loc expression.

    Before:

    df.loc[ lambda df_: df_['x'] > df_['w'] ]

    Now:

    df.loc[ pd.col('x') > pd.col('w') ]

    Note: You cannot use pd.col with a series, only a data frame.

  34. To filter a data frame by rows, use the same syntax and rules as for series:

    df.loc[ lambda df_: df_['x'] > df_['w'] ]

    The lambda still returns a boolean series. The expression can use any column from the data frame.

    Tomorrow: How Pandas 3 improves on this.

  35. To filter a #Python #Pandas data frame by rows, use the same syntax and rules as for series:

    df.loc[ lambda df_: df_['x'] > df_['w'] ]

    The lambda still returns a boolean series. The expression can use any column from the data frame.

    Tomorrow: How Pandas 3 improves on this.

  36. AI With Python 2026 (Part 5)

    Data is only valuable when you can understand it.

    Learn:
    DataFrames
    Data cleaning
    Data analysis
    Preparing data for AI

    Pandas turns raw data into insights.

    Read: abkarikari23.medium.com/ai-wit

    #AI #Python #Pandas #DataScience #JMSM #KNKA #MachineLearning #AIWithPython2026

  37. AI With Python 2026 (Part 5)

    Data is only valuable when you can understand it.

    Learn:
    DataFrames
    Data cleaning
    Data analysis
    Preparing data for AI

    Pandas turns raw data into insights.

    Read: abkarikari23.medium.com/ai-wit

    #AI #Python #Pandas #DataScience #JMSM #KNKA #MachineLearning #AIWithPython2026

  38. Why do I use loc+lambda to filter a series?

    1. If earlier lines filter common values, later loc/lambda lines have less to filter -- so queries run faster.
    2. It's easier to build queries, one line at a time.
    3. No assignment means less to track and clean up.

  39. Why do I use loc+lambda to filter a #Python #Pandas series?

    1. If earlier lines filter common values, later loc/lambda lines have less to filter -- so queries run faster.
    2. It's easier to build queries, one line at a time.
    3. No assignment means less to track and clean up.

  40. Best filter method for a series? Use loc + lambda, thus filtering the series you got, not the global s:

    s = pd.Series([10, 15, 20, 25, 30])

    (
    s
    .loc[ lambda s_: (s_ > 20)] # filters s
    .loc[ lambda s_: (s_ % 2 == 1) ] # filters output from first 1
    )

  41. Best filter method for a #Python #Pandas series? Use loc + lambda, thus filtering the series you got, not the global s:

    s = pd.Series([10, 15, 20, 25, 30])

    (
    s
    .loc[ lambda s_: (s_ > 20)] # filters s
    .loc[ lambda s_: (s_ % 2 == 1) ] # filters output from first 1
    )

  42. My favorite way to apply multiple filters to a #Python #Pandas series? Method chaining calling loc 2x:

    s = pd.Series([10, 15, 20, 25, 30])

    (
    s
    .loc[ (s > 20)] # filters s
    .loc[ (s % 2 == 1) ] # filters line 1
    )

    But: This can break! Tomorrow, a better way.

  43. When applying multiple filters to a #Python #Pandas series, it's often best to use multiple lines:

    s = pd.Series([10, 15, 20, 25, 30])

    s.loc[ (s > 20) &
    (s % 2 == 1) ]

    This is easier to read, write, and maintain.

  44. Want to filter a #Python #Pandas series with two conditions? One option: Combine two boolean series with &.

    But careful: Put () around each boolean condition.

    s = pd.Series([10, 15, 20, 25, 30])
    s.loc[ (s > 20) & (s % 2 == 1) ] # just 25