Skip to content

Commit

Permalink
🟢 adding test with np.nan
Browse files Browse the repository at this point in the history
Passes right away
  • Loading branch information
pierrecamilleri committed Sep 13, 2024
1 parent dac439f commit a80333e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frictionless/formats/pandas/__spec__/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from decimal import Decimal

import isodate
import numpy as np
import pandas as pd
import pytz
from dateutil.tz import tzoffset, tzutc
Expand Down Expand Up @@ -45,6 +46,15 @@ def test_pandas_parser():
assert resource.read_rows() == tc["expected_rows"], tc["name"]


def test_pandas_parser_with_nan():
dataframe = pd.DataFrame(data={"x": [np.nan]})

with TableResource(data=dataframe) as resource:
test_name = 'np.nan converted to Decimal("NaN")'
row = resource.read_rows()[0]
assert row["x"].is_nan(), test_name


def test_pandas_parser_from_dataframe_with_primary_key_having_datetime():
df = pd.read_csv("data/vix.csv", sep=";", parse_dates=["Date"], index_col=["Date"]) # type: ignore
with TableResource(data=df) as resource:
Expand Down

0 comments on commit a80333e

Please sign in to comment.