Giter VIP home page Giter VIP logo

Comments (5)

cmdlineluser avatar cmdlineluser commented on May 30, 2024

I'm not a pandera user - but this is my understanding of why it is failing:

It seems the failure_case column can be a string or a struct.

In the case of a struct, this fails:

).cast(
{
"failure_case": pl.Utf8,

import polars as pl

df = pl.DataFrame({
    'failure_case': [{'case_id': 'abc', 'extract_date': None}]
})

df.with_columns(pl.col("failure_case").cast(pl.String))
# ComputeError: conversion from `struct[2]` to `str` failed in column ...

A struct can be "stringified" in Polars via .struct.json_encode()

>>> df.with_columns(pl.col("failure_case").struct.json_encode())
shape: (1, 1)
┌───────────────────────────────────────┐
│ failure_case                          │
│ ---                                   │
│ str                                   │
╞═══════════════════════════════════════╡
│ {"case_id":"abc","extract_date":null} │
└───────────────────────────────────────┘

But I'm not sure if that's what pandera wants to do in this case.

from pandera.

cosmicBboy avatar cosmicBboy commented on May 30, 2024

Good catch! #1608 should address this

from pandera.

obiii avatar obiii commented on May 30, 2024

Hi @cosmicBboy

I was previously using the 0.19.3b that I installed using
Pip install pre ‘pandera[polars]’

I dnt see the new tag woth your PR.
Can you please let me know how do I use/install the updatws you have made in this PR?

from pandera.

cosmicBboy avatar cosmicBboy commented on May 30, 2024

Just cut a new beta release: https://github.com/unionai-oss/pandera/releases/tag/v0.19.0b4

from pandera.

obiii avatar obiii commented on May 30, 2024

Thanks!

from pandera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.