多索引 问答列表

将 Pandas GroupBy 多索引输出从 Series 转换回 DataFrame

作者:saveenr 提问时间:4/30/2012

我有一个数据帧: City Name 0 Seattle Alice 1 Seattle Bob 2 Portland Mallory 3 Seattle Mallory 4 Seattle Bo...

在 pandas MultiIndex DataFrame 中选择行

作者:cs95 提问时间:12/26/2018

选择/筛选索引为 MultiIndex 的数据帧行的最常见 pandas 方法是什么? 基于单个值/标签的切片 基于一个或多个级别的多个标签进行切片 筛选布尔条件和表达式 哪些方法适用于什么情况 ...

使用 MultiIndex 分配给 Pandas DataFrame 的整列?

作者:Leon 提问时间:3/18/2023

我有一个带有 MultiIndex 的 DataFrame(调用),我想将另一个具有单级索引的 DataFrame(调用) 的整列中的值分配给 。midx_dfsour_dfmidx_df 的所有索...

删除多索引级别,但保留列名 - Pandas

作者:HappyPy 提问时间:6/19/2017

我有一个看起来像这样的df a b c c1 c2 0 87 33 32 34 1 32 10 45 62 2 78 83 99 71 我想删除该级别,但保留所有其他列名c a b c1...

pandas MultiIndex 的多个切片器

作者:goweon 提问时间:5/23/2023

我想从具有多个独立索引器的 MultiIndex 中选择多个列。例如 df = pd.DataFrame( np.zeros((2,4)), columns=pd.MultiIndex.from...

在 Pandas Multiindex 中,如何在不知道关卡位置的情况下进行索引切片?

作者:byrey3 提问时间:7/3/2023

我有一个处理 pandas 数据帧的程序,使用 2 个级别(日期和数据)的多索引,例如: Date_Time Data date1 a b c date2 a b c date3 a ...

切片秒级 datetime multindex 数据帧

作者:Nicolas Rey 提问时间:5/3/2023

我有一个数据帧,看起来像这样: 我正在尝试从日期开始切片特定符号和作为。 行为 df.loc[symbol] 我得到那个数据帧: 所以它从 2021-3-1 到 2023-1-31。 我有一...

Python Pandas - 重复字典以适应 MultiIndex Dataframe

作者:Aster 提问时间:11/11/2023

我有想要使用的 MultiIndex Dataframe 的结构(灵感来自文档)。我想用一个字典在每个级别上实例化它。 MultiIndex DataFrame 常规结构: import pand...

使用元组进行多索引

作者:Simon 提问时间:11/11/2023

我有一个多维的.我知道第一个 N 维和最后一个 M 维的形状。例如,np.array >>> n = (3,4,5) >>> m = (6,) >>> a = np.ones(n + m) >>> ...

将“gt”与两个 multindex datframe 一起使用

作者:AndysPythonStuff 提问时间:10/30/2023

我最近问了一个问题,Timeless 回答了一段引人入胜的代码,它做了它应该做的事情。 基本上,我使用雅虎财经的多索引时间序列 df,使用级别 0 索引作为“Adj Close”和“High”。1 ...


共27条 当前第1页