generated from uniswapfoundation/v4-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
save_csv.py
33 lines (25 loc) · 1.12 KB
/
save_csv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pandas as pd
def save_to_csv(provider_payoff, provider_payoff_with_options, options_value, filename):
"""
Save the provided data arrays to a CSV file.
Parameters:
provider_payoff (numpy.ndarray): The provider payoff data.
provider_payoff_with_options (numpy.ndarray): The provider payoff with options data.
options_value (numpy.ndarray): The options value data.
filename (str): The name of the CSV file to save the data to.
Returns:
None
"""
# Create a DataFrame for each data array
df_provider_payoff = pd.DataFrame(provider_payoff.T)
df_provider_payoff["Type"] = "Provider Payoff"
df_provider_payoff_with_options = pd.DataFrame(provider_payoff_with_options.T)
df_provider_payoff_with_options["Type"] = "Provider Payoff with Options"
df_options_value = pd.DataFrame(options_value.T)
df_options_value["Type"] = "Options Value"
# Concatenate the DataFrames along the row axis
df = pd.concat(
[df_provider_payoff, df_provider_payoff_with_options, df_options_value]
)
# Save the DataFrame to a CSV file
df.to_csv(filename, index=False)