已关闭此问题为not reproducible or was caused by typos。它目前不接受回答。
此问题是由打印错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这一个是解决的方式不太可能帮助未来的读者。
8天前关闭
Improve this question
我正在努力做到以下几点:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# Assuming you have already created dfTienen_selected
# Subset your DataFrame with the columns of interest
df_subset = dfTienen_final[['avg_value', 'value_diff', 'percentage', 'rain_1h', 'Rain_cumulative_2h', 'Rain_cumulative_3h', 'Rain_cumulative_4h', 'Rain_cumulative_5h', 'Rain_cumulative_6h', 'dry_hours_within_group']]
# Assuming you have already created dfTienen_selected
# Calculate the correlation matrix for all numeric columns
correlation_matrix = df_subset.corr()
# Create a heatmap of the correlation matrix focusing on 'avg_value' correlations
plt.figure(figsize=(12, 8))
sns.heatmap(correlation_matrix[['avg_value']], annot=True, cmap='coolwarm', linewidths=0.5)
plt.title('Correlation Heatmap with avg_value')
plt.show()
然而,我得到这个错误:
DataFrame.corr() missing 2 required positional arguments: 'col1' and 'col2'
然而,当我查看pandas官方文档时,没有提到这个位置参数:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.corr.html
我错过了什么?
我用的是Pandas2.0.3
1条答案
按热度按时间u3r8eeie1#
它是固定的,我使用的是pyspark dataframe,而不是pandas:)