猿问

pandas.isin 全部大写?

我找到了pandas的isin函数,但看起来所有大写字母都没有显示?


import pandas as pd

df = pd.read_json('{"Technology Group":{"0":"Cloud","1":"Cloud","2":"Cloud","3":"Collaboration","4":"Collaboration","5":"Collaboration","6":"Collaboration","7":"Collaboration","8":"Collaboration","9":"Core", "10": "Software"},"Technology":{"0":"AMP","1":"EWS","2":"Webex","3":"Telepresence","4":"Call Manager","5":"Contact Center","6":"MS Voice","7":"Apps","8":"PRIME  ","9":"Wirelees", "10": "Prime Infrastructure"}}')


+------------------+----------------------+

| Technology Group | Technology           |

+------------------+----------------------+

| Cloud            | AMP                  |

+------------------+----------------------+

| Cloud            | EWS                  |

+------------------+----------------------+

| Cloud            | Webex                |

+------------------+----------------------+

| Collaboration    | Telepresence         |

+------------------+----------------------+

| Collaboration    | Call Manager         |

+------------------+----------------------+

| Collaboration    | Contact Center       |

+------------------+----------------------+

| Collaboration    | MS Voice             |

+------------------+----------------------+

| Collaboration    | Apps                 |

+------------------+----------------------+

| Collaboration    | PRIME                |

+------------------+----------------------+

| Core             | Wirelees             |

+------------------+----------------------+

| Software         | Prime Infrastructure |

+------------------+----------------------+


tech_input2 = ['AMP', 'Call Manager', 'PRIME']

df = df[df['Technology'].isin(tech_input2)]

它将显示下表:


+------------------+--------------+

| Technology Group | Technology   |

+------------------+--------------+

| Cloud            | AMP          |

+------------------+--------------+

| Collaboration    | Call Manager |

+------------------+--------------+


这是一个错误吗?还是我做错了什么?从技术上讲,它不是表格中原始最后一行的副本,但不确定如何破译它。它似乎更像是包含而不是isin ...


HUWWW
浏览 237回答 1
1回答
随时随地看视频慕课网APP

相关分类

Python
我要回答