Instruction: Read a CSV file and compute the average price grouped by category

Output:
import pandas as pd

df = pd.read_csv('data.csv')
result = df.groupby('category')['price'].mean()
print(result)


Instruction: Replace negative values with zero in the salary column using numpy and pandas

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
df['salary'] = np.where(df['salary'] < 0, 0, df['salary'])
print(df)


Instruction: Read a CSV file and calculate the mean of the quantity column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['quantity'].mean())


Instruction: Using numpy, calculate the mean of values in the price column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['price'].to_numpy()
print(np.mean(values))


Instruction: Load a CSV file and filter rows where salary is greater than 26

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['salary'] > 26]
print(filtered_df)


Instruction: Read a CSV file and calculate the mean of the score column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['score'].mean())


Instruction: Read a CSV file and calculate the mean of the price column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['price'].mean())


Instruction: Replace negative values with zero in the age column using numpy and pandas

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
df['age'] = np.where(df['age'] < 0, 0, df['age'])
print(df)


Instruction: Read a CSV file and compute the average score grouped by region

Output:
import pandas as pd

df = pd.read_csv('data.csv')
result = df.groupby('region')['score'].mean()
print(result)


Instruction: Using numpy, calculate the mean of values in the score column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['score'].to_numpy()
print(np.mean(values))


Instruction: Load a CSV file and filter rows where salary is greater than 28

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['salary'] > 28]
print(filtered_df)


Instruction: Load a CSV file and filter rows where score is greater than 29

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['score'] > 29]
print(filtered_df)


Instruction: Load a CSV file and filter rows where price is greater than 38

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['price'] > 38]
print(filtered_df)


Instruction: Replace negative values with zero in the quantity column using numpy and pandas

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
df['quantity'] = np.where(df['quantity'] < 0, 0, df['quantity'])
print(df)


Instruction: Read a CSV file and calculate the mean of the salary column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['salary'].mean())


Instruction: Load a CSV file and filter rows where price is greater than 32

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['price'] > 32]
print(filtered_df)


Instruction: Using numpy, calculate the mean of values in the age column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['age'].to_numpy()
print(np.mean(values))


Instruction: Read a CSV file and calculate the mean of the quantity column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['quantity'].mean())


Instruction: Load a CSV file and filter rows where score is greater than 40

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['score'] > 40]
print(filtered_df)


Instruction: Using numpy, calculate the mean of values in the score column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['score'].to_numpy()
print(np.mean(values))


Instruction: Read a CSV file and calculate the mean of the quantity column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['quantity'].mean())


Instruction: Read a CSV file and compute the average score grouped by region

Output:
import pandas as pd

df = pd.read_csv('data.csv')
result = df.groupby('region')['score'].mean()
print(result)


Instruction: Using numpy, calculate the mean of values in the age column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['age'].to_numpy()
print(np.mean(values))


Instruction: Load a CSV file and filter rows where age is greater than 39

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['age'] > 39]
print(filtered_df)


Instruction: Read a CSV file and calculate the mean of the price column

Output:
import pandas as pd

df = pd.read_csv('data.csv')
print(df['price'].mean())


Instruction: Load a CSV file and filter rows where age is greater than 12

Output:
import pandas as pd

df = pd.read_csv('data.csv')
filtered_df = df[df['age'] > 12]
print(filtered_df)


Instruction: Replace negative values with zero in the price column using numpy and pandas

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
df['price'] = np.where(df['price'] < 0, 0, df['price'])
print(df)


Instruction: Using numpy, calculate the mean of values in the quantity column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['quantity'].to_numpy()
print(np.mean(values))


Instruction: Using numpy, calculate the mean of values in the salary column from a CSV file

Output:
import pandas as pd
import numpy as np

df = pd.read_csv('data.csv')
values = df['salary'].to_numpy()
print(np.mean(values))