Data Cleaning and Preprocessing
Example Prompt:
Example Response:
Related Tasks:
Exploratory Data Analysis (EDA)
Example Prompt:
Example Response:
Related Tasks:
Creating Reports and Dashboards
Example Prompt:
Example Response:
Related Tasks:
Generating Visualizations
Example Prompt:
Example Response:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Load the dataset
file_path = 'file_path.csv'
df = pd.read_csv(file_path)
# Example: Create a bar chart for a categorical column
# Replace 'categorical_column' with the name of your column
plt.figure(figsize=(10, 6))
sns.countplot(x='categorical_column', data=df)
plt.title('Bar Chart of Categorical Column')
plt.xlabel('Categories')
plt.ylabel('Count')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
Related Tasks:
Performing Statistical Tests
Example Prompt:
Example Response:
from scipy import stats
group1 = df[df['group_column'] == 'Group1']['value_column']
group2 = df[df['group_column'] == 'Group2']['value_column']
t_stat, p_value = stats.ttest_ind(group1, group2)
print(f'T-statistic: {t_stat}, P-value: {p_value}')
correlation = df['variable1'].corr(df['variable2'])
print(f'Correlation coefficient: {correlation}')
contingency_table = pd.crosstab(df['categorical_var1'], df['categorical_var2'])
chi2, p, dof, expected = stats.chi2_contingency(contingency_table)
print(f'Chi2: {chi2}, P-value: {p}')
import statsmodels.api as sm
X = df[['predictor1', 'predictor2']]
y = df['outcome']
X = sm.add_constant(X) # Adds a constant term to the predictor
model = sm.OLS(y, X).fit()
print(model.summary())
Related Tasks: