Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 29885
import statsmodels.api as sm import pandas as pd ds = sm.datasets.grunfeld.load_pandas()
ds.data[ds.data.year > 1950].pivot_table(values=["value", "invest"], index=["firm"], columns=["year"])
value invest \ year 1951 1952 1953 1954 1951 1952 firm American Steel 46.082 57.616 57.441 47.165 6.532 7.329 Atlantic Refining 327.300 359.400 398.400 365.700 80.300 85.400 Chrysler 809.000 727.000 1001.500 703.200 160.620 145.000 Diamond Match 83.040 74.420 63.510 58.120 4.670 6.000 General Electric 1819.400 2079.700 2371.600 2759.900 135.200 157.300 General Motors 4833.000 4924.900 6241.700 5593.600 755.900 891.200 Goodyear 339.900 474.800 496.000 474.500 56.490 65.980 IBM 676.900 702.000 793.500 927.300 95.300 99.490 US Steel 2289.500 2159.400 2031.300 2115.500 588.200 645.500 Union Oil 179.000 178.100 186.800 192.700 64.770 72.680 Westinghouse 723.800 864.100 1193.500 1188.900 54.380 71.780 year 1953 1954 firm American Steel 9.02 6.281 Atlantic Refining 91.90 81.430 Chrysler 174.93 172.490 Diamond Match 6.53 5.120 General Electric 179.50 189.600 General Motors 1304.40 1486.700 Goodyear 66.11 49.340 IBM 127.52 135.720 US Steel 641.00 459.300 Union Oil 73.86 89.510 Westinghouse 90.08 68.600
data.data
invest value capital firm year 0 317.600 3078.500 2.800 General Motors 1935 1 391.800 4661.700 52.600 General Motors 1936 2 410.600 5387.100 156.900 General Motors 1937 3 257.700 2792.200 209.200 General Motors 1938 4 330.800 4313.200 203.400 General Motors 1939 5 461.200 4643.900 207.200 General Motors 1940 6 512.000 4551.200 255.200 General Motors 1941 7 448.000 3244.100 303.700 General Motors 1942 8 499.600 4053.700 264.100 General Motors 1943 9 547.500 4379.300 201.600 General Motors 1944 10 561.200 4840.900 265.000 General Motors 1945 11 688.100 4900.900 402.200 General Motors 1946 12 568.900 3526.500 761.500 General Motors 1947 13 529.200 3254.700 922.400 General Motors 1948 14 555.100 3700.200 1020.100 General Motors 1949 15 642.900 3755.600 1099.000 General Motors 1950 16 755.900 4833.000 1207.700 General Motors 1951 17 891.200 4924.900 1430.500 General Motors 1952 18 1304.400 6241.700 1777.300 General Motors 1953 19 1486.700 5593.600 2226.300 General Motors 1954 20 209.900 1362.400 53.800 US Steel 1935 21 355.300 1807.100 50.500 US Steel 1936 22 469.900 2676.300 118.100 US Steel 1937 23 262.300 1801.900 260.200 US Steel 1938 24 230.400 1957.300 312.700 US Steel 1939 25 361.600 2202.900 254.200 US Steel 1940 26 472.800 2380.500 261.400 US Steel 1941 27 445.600 2168.600 298.700 US Steel 1942 28 361.600 1985.100 301.800 US Steel 1943 29 288.200 1813.900 279.100 US Steel 1944 .. ... ... ... ... ... 190 1.360 65.850 3.310 Diamond Match 1945 191 2.240 69.540 3.230 Diamond Match 1946 192 3.810 64.970 3.900 Diamond Match 1947 193 5.660 68.000 5.380 Diamond Match 1948 194 4.210 71.240 7.390 Diamond Match 1949 195 3.420 69.050 8.740 Diamond Match 1950 196 4.670 83.040 9.070 Diamond Match 1951 197 6.000 74.420 9.930 Diamond Match 1952 198 6.530 63.510 11.680 Diamond Match 1953 199 5.120 58.120 14.330 Diamond Match 1954 200 2.938 30.284 52.011 American Steel 1935 201 5.643 43.909 52.903 American Steel 1936 202 10.233 107.020 54.499 American Steel 1937 203 4.046 68.306 59.722 American Steel 1938 204 3.326 84.164 61.659 American Steel 1939 205 4.680 69.157 62.243 American Steel 1940 206 5.732 60.148 63.361 American Steel 1941 207 12.117 49.332 64.861 American Steel 1942 208 15.276 75.180 67.953 American Steel 1943 209 9.275 62.050 69.590 American Steel 1944 210 9.577 59.152 69.144 American Steel 1945 211 3.956 68.424 70.269 American Steel 1946 212 3.834 48.505 71.051 American Steel 1947 213 5.970 40.507 71.508 American Steel 1948 214 6.433 39.961 73.827 American Steel 1949 215 4.770 36.494 75.847 American Steel 1950 216 6.532 46.082 77.367 American Steel 1951 217 7.329 57.616 78.631 American Steel 1952 218 9.020 57.441 80.215 American Steel 1953 219 6.281 47.165 83.788 American Steel 1954 [220 rows x 5 columns]