'DataFrame has no object .split()
i sum up the best sales from all months
all_months_data.groupby('Month').sum()
Quantity Ordered Price Each Sales
Month
1 10903 1811768.38 1822256.73
2 13449 2188884.72 2202022.42
3 17005 2791207.83 2807100.38
4 20558 3367671.02 3390670.24
5 18667 3135125.13 3152606.75
6 15253 2562025.61 2577802.26
7 16072 2632539.56 2647775.76
8 13448 2230345.42 2244467.88
9 13109 2084992.09 2097560.13
10 22703 3715554.83 3736726.88
11 19798 3180600.68 3199603.20
12 28114 4588415.41 4613443.34
am trying to split the the results above with the code below but it returns the an error saying
DataFrame has not object .split()
best_sales = all_months_data.groupby('Month').sum()
ouptut = [int(i) for i in best_sales.split(',')]
print(ouptut)
Solution 1:[1]
I believe you can convert a dataframe into a list. I haven't tested this but you could try this.
best_sales = all_months_data.groupby('Month').sum()
ouptut = [int(i) for i in best_sales.values.tolist()]
print(ouptut)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wibo Kuipers |
