Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

elec_map = pd.DataFrame({
    'Channel-ID': {
        0: 1,
        1: 2,
        2: 3,
        3: 4,
        4: 5,
        5: 6,
        6: 7,
        7: 8,
        8: 9,
        9: 10,
        10: 11,
        11: 12,
        12: 13,
        13: 14,
        14: 15,
        15: 16,
        16: 17,
        17: 18,
        18: 19,
        19: 20,
        20: 21,
        21: 22,
        22: 23,
        23: 24,
        24: 25,
        25: 26,
        26: 27,
        27: 28,
        28: 29,
        29: 30,
        30: 31,
        31: 32,
        32: 33,
        33: 34
    },
    'Electrode-ID': {
        0: 'CPz',
        1: 'O1',
        2: 'CP3',
        3: 'FC3',
        4: 'F3',
        5: 'POz',
        6: 'C3',
        7: 'Pz',
        8: 'T7',
        9: 'Fp1',
        10: 'FT7',
        11: 'P9',
        12: 'F7',
        13: 'P3',
        14: 'TP7',
        15: 'P7',
        16: 'CP4',
        17: 'P4',
        18: 'Cz',
        19: 'O2',
        20: 'FCz',
        21: 'C4',
        22: 'Fp2',
        23: 'Fz',
        24: 'F8',
        25: 'TP8',
        26: 'P8',
        27: 'P10',
        28: 'FT8',
        29: 'F4',
        30: 'T8',
        31: 'FC4',
        32: 'LPA',
        33: 'RPA'
    }
})

currents_df = pd.DataFrame({
    'channel': {
        11: 'F3',
        19: 'FT9',
        20: 'FT7',
        21: 'FC5',
        30: 'T9',
        31: 'T7',
        40: 'T10',
        41: 'TP9',
        42: 'TP7',
        43: 'CP5',
        44: 'CP3',
        53: 'P7'
    },
    'current': {
        11: 0.0008434357056398325,
        19: -0.0004334751646561182,
        20: 0.0,
        21: 0.001,
        30: -0.0009347905292310828,
        31: 0.0004599508945342969,
        40: -0.0008397712315939873,
        41: 0.0,
        42: 0.001,
        43: -0.0007919630745188124,
        44: -0.001,
        53: 0.0006966133998258704
    }
})


merged_df = elec_map.merge(currents_df,
                           left_on='Electrode-ID',
                           right_on='channel')

Issue Description

Hi,

as mention in the title, it seems there is some rounding happening in the merge; so after few non-0 currents are 0

any idea?

thanks

Expected Behavior

no rounding (non-0 values)

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.9.13.final.0 python-bits : 64 OS : Darwin OS-release : 22.1.0 Version : Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 1.5.3 numpy : 1.22.4 pytz : 2022.1 dateutil : 2.8.2 setuptools : 63.3.0 pip : 22.3.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.0 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.8.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.5.2 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : 1.10.0 snappy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None tzdata : None

Comment From: phofl

Hi, thanks for your report. Please reduce your example so that only the rows that are strictly necessary are in it.

Comment From: ggrrll

just realised that this is not related to merging... also subsetting creates the same issue (similar operation)

currents_df[currents_df.channel.isin(elec_map['Electrode-ID']) ]

Comment From: phofl

Please reduce the size of your DataFrame. It should not have more than 2 or three rows if possible

Comment From: ggrrll

never mind -- was a trivial (different) reason

(you can delete the issue)