Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -35,12 +35,14 @@ def calculate_volume_profile(data, row_layout):
|
|
35 |
# Create a DataFrame for volume profile
|
36 |
volume_profile = pd.DataFrame(0, index=bin_edges[:-1], columns=['Total Volume'])
|
37 |
|
38 |
-
for
|
|
|
39 |
bin_indices = np.digitize([row['Low'], row['High']], bin_edges) - 1
|
40 |
-
bin_indices = [max(0, min(bins-2, b)) for b in bin_indices]
|
41 |
|
42 |
-
#
|
43 |
-
|
|
|
44 |
|
45 |
return volume_profile
|
46 |
|
|
|
35 |
# Create a DataFrame for volume profile
|
36 |
volume_profile = pd.DataFrame(0, index=bin_edges[:-1], columns=['Total Volume'])
|
37 |
|
38 |
+
for _, row in data.iterrows():
|
39 |
+
# Ensure the bin indices are integers
|
40 |
bin_indices = np.digitize([row['Low'], row['High']], bin_edges) - 1
|
41 |
+
bin_indices = [int(max(0, min(bins - 2, b))) for b in bin_indices]
|
42 |
|
43 |
+
# Ensure bin_indices are valid for iloc slicing
|
44 |
+
if bin_indices[0] <= bin_indices[1]:
|
45 |
+
volume_profile.iloc[bin_indices[0]:bin_indices[1] + 1, 0] += row['Volume']
|
46 |
|
47 |
return volume_profile
|
48 |
|