[英]Correlation between two data frames in Python
I have a DataFrame with Job Area Profiles which look similar to this:我有一个带有 Job Area Profiles 的 DataFrame,看起来类似于:
Now I have some user input, which creates an user DataFrame.现在我有一些用户输入,它创建了一个用户 DataFrame。 This looks like this:
这看起来像这样:
Now, I want to determine the correlation between User XYZ's Profile and the profile for Cloud and Data Science.现在,我想确定用户 XYZ 的个人资料与云和数据科学的个人资料之间的相关性。 I've tried this:
我试过这个:
job_df.corrwith(user_df)
But this is getting me NaN.但这让我感到NaN。 How do I solve this?
我该如何解决这个问题?
The function is working, but you cannot find the correlation with a dataframe consisting of only one datapoint, since you'll get a divide by zero error.该函数正在运行,但您无法找到与仅包含一个数据点的数据帧的相关性,因为您将得到除以零的错误。 It therefore returns NaNs, see the equation .
因此,它返回 NaN, 参见方程。
If you run the function with the full datasets then you'll be fine.如果您使用完整的数据集运行该函数,那么您会没事的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.