从Python的嵌套字典到平坦的Pandas数据框

huangapple go评论79阅读模式
英文:

From Python's nested dictionary to flat Pandas dataframe

问题

I have a nested dictionary of the public information of employment history of people and I would like to construct the panel data similar to the following table.

Here is the nested dictionary.

The nested dictionary for person 1 in the above table is as follows.

  1. {
  2. 'basicInformation': {
  3. 'individualId': 6092353,
  4. 'firstName': 'A',
  5. 'middleName': 'ANTHONY',
  6. 'lastName': 'OLIVETTI',
  7. 'otherNames': ['ALBERT A OLIVETTI', 'ALBERT ANTHONY OLIVETTI', 'ANTHONY A OLIVETTI', 'ANTHONY OLIVETTI'],
  8. 'bcScope': 'Active',
  9. 'iaScope': 'Active',
  10. 'daysInIndustryCalculatedDate': '10/16/2013'
  11. },
  12. 'currentEmployments': [
  13. {
  14. 'firmId': 8174,
  15. 'firmName': 'UBS FINANCIAL SERVICES INC.',
  16. 'iaOnly': 'N',
  17. 'registrationBeginDate': '10/17/2013',
  18. 'firmBCScope': 'ACTIVE',
  19. 'firmIAScope': 'ACTIVE',
  20. 'iaSECNumber': '7163',
  21. 'iaSECNumberType': '801',
  22. 'bdSECNumber': '16267',
  23. 'branchOfficeLocations': [
  24. {
  25. 'locatedAtFlag': 'Y',
  26. 'supervisedFromFlag': 'N',
  27. 'privateResidenceFlag': 'N',
  28. 'branchOfficeId': '88789',
  29. 'street1': '1251 AVE OF THE AMERICAS',
  30. 'street2': '2ND FLOOR',
  31. 'city': 'NEW YORK',
  32. 'cityAlias': ['MANHATTAN', 'NEW YORK', 'NEW YORK CITY', 'NY', 'NY CITY', 'NYC'],
  33. 'state': 'NY',
  34. 'country': 'United States',
  35. 'zipCode': '10020',
  36. 'latitude': '40.758908',
  37. 'longitude': '-73.97902',
  38. 'geoLocation': '40.758908,-73.97902',
  39. 'nonRegisteredOfficeFlag': 'N',
  40. 'elaBeginDate': '07/15/2013'
  41. }
  42. ]
  43. }
  44. ],
  45. 'currentIAEmployments': [
  46. {
  47. 'firmId': 8174,
  48. 'firmName': 'UBS FINANCIAL SERVICES INC.',
  49. 'iaOnly': 'Y',
  50. 'registrationBeginDate': '2/24/2014',
  51. 'firmBCScope': 'ACTIVE',
  52. 'firmIAScope': 'ACTIVE',
  53. 'iaSECNumber': '7163',
  54. 'iaSECNumberType': '801',
  55. 'bdSECNumber': '16267',
  56. 'branchOfficeLocations': [
  57. {
  58. 'locatedAtFlag': 'Y',
  59. 'supervisedFromFlag': 'N',
  60. 'privateResidenceFlag': 'N',
  61. 'branchOfficeId': '88789',
  62. 'street1': '1251 AVE OF THE AMERICAS',
  63. 'street2': '2ND FLOOR',
  64. 'city': 'NEW YORK',
  65. 'cityAlias': ['MANHATTAN', 'NEW YORK', 'NEW YORK CITY', 'NY', 'NY CITY', 'NYC'],
  66. 'state': 'NY',
  67. 'country': 'United States',
  68. 'zipCode': '10020',
  69. 'latitude': '40.758908',
  70. 'longitude': '-73.97902',
  71. 'geoLocation': '40.758908,-73.97902',
  72. 'nonRegisteredOfficeFlag': 'N',
  73. 'elaBeginDate': '07/15/2013'
  74. }
  75. ]
  76. }
  77. ],
  78. 'previousEmployments': [],
  79. 'previousIAEmployments': [],
  80. 'disclosureFlag': 'N',
  81. 'iaDisclosureFlag': 'N',
  82. 'disclosures': [],
  83. 'examsCount': {
  84. 'stateExamCount': 1,
  85. 'principalExamCount': 0,
  86. 'productExamCount': 3
  87. },
  88. 'stateExamCategory': [
  89. {
  90. 'examCategory': 'Series 66',
  91. 'examName': 'Uniform Combined State Law Examination',
  92. 'examTakenDate': '2/18/2014',
  93. 'examScope': 'BOTH'
  94. }
  95. ],
  96. 'principalExamCategory': [],
  97. 'productExamCategory': [
  98. {
  99. 'examCategory': 'SIE',
  100. 'examName': 'Securities Industry Essentials Examination',
  101. 'examTakenDate': '10/1/2018',
  102. 'examScope': 'BC'
  103. },
  104. {
  105. 'examCategory': 'Series 3',
  106. 'examName': 'National Commodity Futures Examination',
  107. 'examTakenDate': '10/27/2014',
  108. 'examScope': 'BC'
  109. },
  110. {
  111. 'examCategory': 'Series 7',
  112. 'examName': 'General Securities Representative Examination',
  113. 'examTaken
  114. <details>
  115. <summary>英文:</summary>
  116. I have a nested dictionary of the public information of employment history of people and I would like to construct the panel data similar to the following table.
  117. [![enter image description here][1]][1]
  118. Here is the nested dictionary.
  119. The nested dictionary for person 1 in the above table is as follows.
  120. {&#39;basicInformation&#39;: {&#39;individualId&#39;: 6092353,
  121. &#39;firstName&#39;: &#39;A&#39;,&#39;middleName&#39;: &#39;ANTHONY&#39;,&#39;lastName&#39;: &#39;OLIVETTI&#39;,
  122. &#39;otherNames&#39;: [&#39;ALBERT A OLIVETTI&#39;,
  123. &#39;ALBERT ANTHONY OLIVETTI&#39;,
  124. &#39;ANTHONY A OLIVETTI&#39;,
  125. &#39;ANTHONY OLIVETTI&#39;],
  126. &#39;bcScope&#39;: &#39;Active&#39;,
  127. &#39;iaScope&#39;: &#39;Active&#39;,
  128. &#39;daysInIndustryCalculatedDate&#39;: &#39;10/16/2013&#39;},
  129. &#39;currentEmployments&#39;: [{&#39;firmId&#39;: 8174,
  130. &#39;firmName&#39;: &#39;UBS FINANCIAL SERVICES INC.&#39;,
  131. &#39;iaOnly&#39;: &#39;N&#39;,
  132. &#39;registrationBeginDate&#39;: &#39;10/17/2013&#39;,
  133. &#39;firmBCScope&#39;: &#39;ACTIVE&#39;,
  134. &#39;firmIAScope&#39;: &#39;ACTIVE&#39;,
  135. &#39;iaSECNumber&#39;: &#39;7163&#39;,
  136. &#39;iaSECNumberType&#39;: &#39;801&#39;,
  137. &#39;bdSECNumber&#39;: &#39;16267&#39;,
  138. &#39;branchOfficeLocations&#39;: [{&#39;locatedAtFlag&#39;: &#39;Y&#39;,
  139. &#39;supervisedFromFlag&#39;: &#39;N&#39;,
  140. &#39;privateResidenceFlag&#39;: &#39;N&#39;,
  141. &#39;branchOfficeId&#39;: &#39;88789&#39;,
  142. &#39;street1&#39;: &#39;1251 AVE OF THE AMERICAS&#39;,
  143. &#39;street2&#39;: &#39;2ND FLOOR&#39;,
  144. &#39;city&#39;: &#39;NEW YORK&#39;,
  145. &#39;cityAlias&#39;: [&#39;MANHATTAN&#39;,
  146. &#39;NEW YORK&#39;,
  147. &#39;NEW YORK CITY&#39;,
  148. &#39;NY&#39;,
  149. &#39;NY CITY&#39;,
  150. &#39;NYC&#39;],
  151. &#39;state&#39;: &#39;NY&#39;,
  152. &#39;country&#39;: &#39;United States&#39;,
  153. &#39;zipCode&#39;: &#39;10020&#39;,
  154. &#39;latitude&#39;: &#39;40.758908&#39;,
  155. &#39;longitude&#39;: &#39;-73.97902&#39;,
  156. &#39;geoLocation&#39;: &#39;40.758908,-73.97902&#39;,
  157. &#39;nonRegisteredOfficeFlag&#39;: &#39;N&#39;,
  158. &#39;elaBeginDate&#39;: &#39;07/15/2013&#39;}]}],
  159. &#39;currentIAEmployments&#39;: [{&#39;firmId&#39;: 8174,
  160. &#39;firmName&#39;: &#39;UBS FINANCIAL SERVICES INC.&#39;,
  161. &#39;iaOnly&#39;: &#39;Y&#39;,
  162. &#39;registrationBeginDate&#39;: &#39;2/24/2014&#39;,
  163. &#39;firmBCScope&#39;: &#39;ACTIVE&#39;,
  164. &#39;firmIAScope&#39;: &#39;ACTIVE&#39;,
  165. &#39;iaSECNumber&#39;: &#39;7163&#39;,
  166. &#39;iaSECNumberType&#39;: &#39;801&#39;,
  167. &#39;bdSECNumber&#39;: &#39;16267&#39;,
  168. &#39;branchOfficeLocations&#39;: [{&#39;locatedAtFlag&#39;: &#39;Y&#39;,
  169. &#39;supervisedFromFlag&#39;: &#39;N&#39;,
  170. &#39;privateResidenceFlag&#39;: &#39;N&#39;,
  171. &#39;branchOfficeId&#39;: &#39;88789&#39;,
  172. &#39;street1&#39;: &#39;1251 AVE OF THE AMERICAS&#39;,
  173. &#39;street2&#39;: &#39;2ND FLOOR&#39;,
  174. &#39;city&#39;: &#39;NEW YORK&#39;,
  175. &#39;cityAlias&#39;: [&#39;MANHATTAN&#39;,
  176. &#39;NEW YORK&#39;,
  177. &#39;NEW YORK CITY&#39;,
  178. &#39;NY&#39;,
  179. &#39;NY CITY&#39;,
  180. &#39;NYC&#39;],
  181. &#39;state&#39;: &#39;NY&#39;,
  182. &#39;country&#39;: &#39;United States&#39;,
  183. &#39;zipCode&#39;: &#39;10020&#39;,
  184. &#39;latitude&#39;: &#39;40.758908&#39;,
  185. &#39;longitude&#39;: &#39;-73.97902&#39;,
  186. &#39;geoLocation&#39;: &#39;40.758908,-73.97902&#39;,
  187. &#39;nonRegisteredOfficeFlag&#39;: &#39;N&#39;,
  188. &#39;elaBeginDate&#39;: &#39;07/15/2013&#39;}]}],
  189. &#39;previousEmployments&#39;: [],
  190. &#39;previousIAEmployments&#39;: [],
  191. &#39;disclosureFlag&#39;: &#39;N&#39;,
  192. &#39;iaDisclosureFlag&#39;: &#39;N&#39;,
  193. &#39;disclosures&#39;: [],
  194. &#39;examsCount&#39;: {&#39;stateExamCount&#39;: 1,
  195. &#39;principalExamCount&#39;: 0,
  196. &#39;productExamCount&#39;: 3},
  197. &#39;stateExamCategory&#39;: [{&#39;examCategory&#39;: &#39;Series 66&#39;,
  198. &#39;examName&#39;: &#39;Uniform Combined State Law Examination&#39;,
  199. &#39;examTakenDate&#39;: &#39;2/18/2014&#39;,
  200. &#39;examScope&#39;: &#39;BOTH&#39;}],
  201. &#39;principalExamCategory&#39;: [],
  202. &#39;productExamCategory&#39;: [{&#39;examCategory&#39;: &#39;SIE&#39;,
  203. &#39;examName&#39;: &#39;Securities Industry Essentials Examination&#39;,
  204. &#39;examTakenDate&#39;: &#39;10/1/2018&#39;,
  205. &#39;examScope&#39;: &#39;BC&#39;},
  206. {&#39;examCategory&#39;: &#39;Series 3&#39;,
  207. &#39;examName&#39;: &#39;National Commodity Futures Examination&#39;,
  208. &#39;examTakenDate&#39;: &#39;10/27/2014&#39;,
  209. &#39;examScope&#39;: &#39;BC&#39;},
  210. {&#39;examCategory&#39;: &#39;Series 7&#39;,
  211. &#39;examName&#39;: &#39;General Securities Representative Examination&#39;,
  212. &#39;examTakenDate&#39;: &#39;10/17/2013&#39;,
  213. &#39;examScope&#39;: &#39;BC&#39;}],
  214. &#39;registrationCount&#39;: {&#39;approvedSRORegistrationCount&#39;: 10,
  215. &#39;approvedFinraRegistrationCount&#39;: 1,
  216. &#39;approvedStateRegistrationCount&#39;: 7,
  217. &#39;approvedIAStateRegistrationCount&#39;: 2},
  218. &#39;registeredStates&#39;: [{&#39;state&#39;: &#39;California&#39;,
  219. &#39;regScope&#39;: &#39;BC&#39;,
  220. &#39;status&#39;: &#39;APPROVED&#39;,
  221. &#39;regDate&#39;: &#39;5/31/2022&#39;},
  222. {&#39;state&#39;: &#39;Connecticut&#39;,
  223. &#39;regScope&#39;: &#39;BC&#39;,
  224. &#39;status&#39;: &#39;APPROVED&#39;,
  225. &#39;regDate&#39;: &#39;2/26/2014&#39;},
  226. {&#39;state&#39;: &#39;Florida&#39;,
  227. &#39;regScope&#39;: &#39;BC&#39;,
  228. &#39;status&#39;: &#39;APPROVED&#39;,
  229. &#39;regDate&#39;: &#39;2/26/2014&#39;},
  230. {&#39;state&#39;: &#39;New Jersey&#39;,
  231. &#39;regScope&#39;: &#39;BC&#39;,
  232. &#39;status&#39;: &#39;APPROVED&#39;,
  233. &#39;regDate&#39;: &#39;1/23/2014&#39;},
  234. {&#39;state&#39;: &#39;New Jersey&#39;,
  235. &#39;regScope&#39;: &#39;IA&#39;,
  236. &#39;status&#39;: &#39;APPROVED&#39;,
  237. &#39;regDate&#39;: &#39;2/24/2014&#39;},
  238. {&#39;state&#39;: &#39;New York&#39;,
  239. &#39;regScope&#39;: &#39;BC&#39;,
  240. &#39;status&#39;: &#39;APPROVED&#39;,
  241. &#39;regDate&#39;: &#39;2/18/2014&#39;},
  242. {&#39;state&#39;: &#39;New York&#39;,
  243. &#39;regScope&#39;: &#39;IA&#39;,
  244. &#39;status&#39;: &#39;APPROVED&#39;,
  245. &#39;regDate&#39;: &#39;10/26/2021&#39;},
  246. {&#39;state&#39;: &#39;North Carolina&#39;,
  247. &#39;regScope&#39;: &#39;BC&#39;,
  248. &#39;status&#39;: &#39;APPROVED&#39;,
  249. &#39;regDate&#39;: &#39;5/31/2022&#39;},
  250. {&#39;state&#39;: &#39;Pennsylvania&#39;,
  251. &#39;regScope&#39;: &#39;BC&#39;,
  252. &#39;status&#39;: &#39;APPROVED&#39;,
  253. &#39;regDate&#39;: &#39;2/26/2014&#39;}],
  254. &#39;registeredSROs&#39;: [{&#39;sro&#39;: &#39;BOX Exchange LLC&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  255. {&#39;sro&#39;: &#39;Cboe Exchange, Inc.&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  256. {&#39;sro&#39;: &#39;FINRA&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  257. {&#39;sro&#39;: &#39;NYSE American LLC&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  258. {&#39;sro&#39;: &#39;NYSE Arca, Inc.&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  259. {&#39;sro&#39;: &#39;NYSE Chicago, Inc.&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  260. {&#39;sro&#39;: &#39;Nasdaq ISE, LLC&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  261. {&#39;sro&#39;: &#39;Nasdaq PHLX LLC&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  262. {&#39;sro&#39;: &#39;Nasdaq Stock Market&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  263. {&#39;sro&#39;: &#39;New York Stock Exchange&#39;, &#39;status&#39;: &#39;APPROVED&#39;}],
  264. &#39;brokerDetails&#39;: {&#39;hasBCComments&#39;: &#39;N&#39;,
  265. &#39;hasIAComments&#39;: &#39;N&#39;,
  266. &#39;legacyReportStatusDescription&#39;: &#39;Not Requested&#39;}}
  267. The nested dictionary for person 2 in the above table is as follows.
  268. {&#39;basicInformation&#39;: {&#39;individualId&#39;: 2652161,
  269. &#39;firstName&#39;: &#39;ALBERT&#39;,
  270. &#39;middleName&#39;: &#39;B&#39;,
  271. &#39;lastName&#39;: &#39;HORMAN&#39;,
  272. &#39;otherNames&#39;: [&#39;A B HORMAN&#39;, &#39;ALBERT WILLIAM HORMAN&#39;, &#39;BILL HORMAN&#39;],
  273. &#39;bcScope&#39;: &#39;Active&#39;,
  274. &#39;iaScope&#39;: &#39;Active&#39;,
  275. &#39;daysInIndustryCalculatedDate&#39;: &#39;9/17/1995&#39;},
  276. &#39;currentEmployments&#39;: [{&#39;firmId&#39;: 7784,
  277. &#39;firmName&#39;: &#39;FIDELITY BROKERAGE SERVICES LLC&#39;,
  278. &#39;iaOnly&#39;: &#39;N&#39;,
  279. &#39;registrationBeginDate&#39;: &#39;1/1/2008&#39;,
  280. &#39;firmBCScope&#39;: &#39;ACTIVE&#39;,
  281. &#39;firmIAScope&#39;: &#39;NOTINSCOPE&#39;,
  282. &#39;bdSECNumber&#39;: &#39;23292&#39;,
  283. &#39;branchOfficeLocations&#39;: [{&#39;locatedAtFlag&#39;: &#39;Y&#39;,
  284. &#39;supervisedFromFlag&#39;: &#39;N&#39;,
  285. &#39;privateResidenceFlag&#39;: &#39;N&#39;,
  286. &#39;branchOfficeId&#39;: &#39;369366&#39;,
  287. &#39;street1&#39;: &#39;825 EAST 1180 SOUTH&#39;,
  288. &#39;city&#39;: &#39;AMERICAN FORK&#39;,
  289. &#39;cityAlias&#39;: [&#39;AM FORK&#39;, &#39;AMERICAN FORK&#39;, &#39;HIGHLAND&#39;, &#39;TIMPANOGOS&#39;],
  290. &#39;state&#39;: &#39;UT&#39;,
  291. &#39;country&#39;: &#39;United States&#39;,
  292. &#39;zipCode&#39;: &#39;84003&#39;,
  293. &#39;latitude&#39;: &#39;40.405984&#39;,
  294. &#39;longitude&#39;: &#39;-111.82903&#39;,
  295. &#39;geoLocation&#39;: &#39;40.405984,-111.82903&#39;,
  296. &#39;nonRegisteredOfficeFlag&#39;: &#39;N&#39;,
  297. &#39;elaBeginDate&#39;: &#39;07/04/2022&#39;}]}],
  298. &#39;currentIAEmployments&#39;: [{&#39;firmId&#39;: 288590,
  299. &#39;firmName&#39;: &#39;FIDELITY PERSONAL AND WORKPLACE ADVISORS&#39;,
  300. &#39;iaOnly&#39;: &#39;Y&#39;,
  301. &#39;registrationBeginDate&#39;: &#39;7/13/2018&#39;,
  302. &#39;firmBCScope&#39;: &#39;NOTINSCOPE&#39;,
  303. &#39;firmIAScope&#39;: &#39;ACTIVE&#39;,
  304. &#39;iaSECNumber&#39;: &#39;112027&#39;,
  305. &#39;iaSECNumberType&#39;: &#39;801&#39;,
  306. &#39;branchOfficeLocations&#39;: [{&#39;locatedAtFlag&#39;: &#39;Y&#39;,
  307. &#39;supervisedFromFlag&#39;: &#39;N&#39;,
  308. &#39;privateResidenceFlag&#39;: &#39;N&#39;,
  309. &#39;street1&#39;: &#39;245 SUMMER STREET, V2A&#39;,
  310. &#39;city&#39;: &#39;BOSTON&#39;,
  311. &#39;cityAlias&#39;: [&#39;BOSTON&#39;],
  312. &#39;state&#39;: &#39;MA&#39;,
  313. &#39;country&#39;: &#39;United States&#39;,
  314. &#39;zipCode&#39;: &#39;02210&#39;,
  315. &#39;latitude&#39;: &#39;42.346571&#39;,
  316. &#39;longitude&#39;: &#39;-71.039563&#39;,
  317. &#39;geoLocation&#39;: &#39;42.346571,-71.039563&#39;,
  318. &#39;nonRegisteredOfficeFlag&#39;: &#39;Y&#39;,
  319. &#39;elaBeginDate&#39;: &#39;07/13/2018&#39;}]}],
  320. &#39;previousEmployments&#39;: [{&#39;iaOnly&#39;: &#39;N&#39;,
  321. &#39;bdSECNumber&#39;: &#39;35097&#39;,
  322. &#39;firmId&#39;: 17507,
  323. &#39;firmName&#39;: &#39;FIDELITY INVESTMENTS INSTITUTIONAL SERVICES COMPANY, INC.&#39;,
  324. &#39;street1&#39;: &#39;49 NORTH 400 WEST&#39;,
  325. &#39;city&#39;: &#39;SALT LAKE CITY&#39;,
  326. &#39;state&#39;: &#39;UT&#39;,
  327. &#39;zipCode&#39;: &#39;84101&#39;,
  328. &#39;registrationBeginDate&#39;: &#39;1/3/2001&#39;,
  329. &#39;registrationEndDate&#39;: &#39;1/1/2008&#39;,
  330. &#39;firmBCScope&#39;: &#39;ACTIVE&#39;,
  331. &#39;firmIAScope&#39;: &#39;NOTINSCOPE&#39;},
  332. {&#39;iaOnly&#39;: &#39;N&#39;,
  333. &#39;bdSECNumber&#39;: &#39;23292&#39;,
  334. &#39;firmId&#39;: 7784,
  335. &#39;firmName&#39;: &#39;FIDELITY BROKERAGE SERVICES LLC&#39;,
  336. &#39;street1&#39;: &#39;900 SALEM STREET&#39;,
  337. &#39;city&#39;: &#39;SMITHFIELD&#39;,
  338. &#39;state&#39;: &#39;RI&#39;,
  339. &#39;country&#39;: &#39;UNITED STATES&#39;,
  340. &#39;zipCode&#39;: &#39;02917&#39;,
  341. &#39;registrationBeginDate&#39;: &#39;9/18/1995&#39;,
  342. &#39;registrationEndDate&#39;: &#39;1/4/2001&#39;,
  343. &#39;firmBCScope&#39;: &#39;ACTIVE&#39;,
  344. &#39;firmIAScope&#39;: &#39;NOTINSCOPE&#39;}],
  345. &#39;previousIAEmployments&#39;: [{&#39;iaOnly&#39;: &#39;Y&#39;,
  346. &#39;iaSECNumber&#39;: &#39;13243&#39;,
  347. &#39;iaSECNumberType&#39;: &#39;801&#39;,
  348. &#39;firmId&#39;: 104555,
  349. &#39;firmName&#39;: &#39;STRATEGIC ADVISERS LLC&#39;,
  350. &#39;street1&#39;: &#39;49 NORTH 400 WEST&#39;,
  351. &#39;city&#39;: &#39;SALT LAKE CITY&#39;,
  352. &#39;state&#39;: &#39;UT&#39;,
  353. &#39;country&#39;: &#39;United States&#39;,
  354. &#39;zipCode&#39;: &#39;84101&#39;,
  355. &#39;registrationBeginDate&#39;: &#39;2/15/2008&#39;,
  356. &#39;registrationEndDate&#39;: &#39;7/13/2018&#39;,
  357. &#39;firmBCScope&#39;: &#39;NOTINSCOPE&#39;,
  358. &#39;firmIAScope&#39;: &#39;ACTIVE&#39;}],
  359. &#39;disclosureFlag&#39;: &#39;N&#39;,
  360. &#39;iaDisclosureFlag&#39;: &#39;N&#39;,
  361. &#39;disclosures&#39;: [],
  362. &#39;examsCount&#39;: {&#39;stateExamCount&#39;: 2,
  363. &#39;principalExamCount&#39;: 0,
  364. &#39;productExamCount&#39;: 2},
  365. &#39;stateExamCategory&#39;: [{&#39;examCategory&#39;: &#39;Series 66&#39;,
  366. &#39;examName&#39;: &#39;Uniform Combined State Law Examination&#39;,
  367. &#39;examTakenDate&#39;: &#39;2/26/2008&#39;,
  368. &#39;examScope&#39;: &#39;BOTH&#39;},
  369. {&#39;examCategory&#39;: &#39;Series 63&#39;,
  370. &#39;examName&#39;: &#39;Uniform Securities Agent State Law Examination&#39;,
  371. &#39;examTakenDate&#39;: &#39;9/7/1995&#39;,
  372. &#39;examScope&#39;: &#39;BC&#39;}],
  373. &#39;principalExamCategory&#39;: [],
  374. &#39;productExamCategory&#39;: [{&#39;examCategory&#39;: &#39;SIE&#39;,
  375. &#39;examName&#39;: &#39;Securities Industry Essentials Examination&#39;,
  376. &#39;examTakenDate&#39;: &#39;10/1/2018&#39;,
  377. &#39;examScope&#39;: &#39;BC&#39;},
  378. {&#39;examCategory&#39;: &#39;Series 7&#39;,
  379. &#39;examName&#39;: &#39;General Securities Representative Examination&#39;,
  380. &#39;examTakenDate&#39;: &#39;9/16/1995&#39;,
  381. &#39;examScope&#39;: &#39;BC&#39;}],
  382. &#39;registrationCount&#39;: {&#39;approvedSRORegistrationCount&#39;: 2,
  383. &#39;approvedFinraRegistrationCount&#39;: 1,
  384. &#39;approvedStateRegistrationCount&#39;: 52,
  385. &#39;approvedIAStateRegistrationCount&#39;: 2},
  386. &#39;registeredStates&#39;: [{&#39;state&#39;: &#39;Alabama&#39;,
  387. &#39;regScope&#39;: &#39;BC&#39;,
  388. &#39;status&#39;: &#39;APPROVED&#39;,
  389. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  390. {&#39;state&#39;: &#39;Alaska&#39;,
  391. &#39;regScope&#39;: &#39;BC&#39;,
  392. &#39;status&#39;: &#39;APPROVED&#39;,
  393. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  394. {&#39;state&#39;: &#39;Arizona&#39;,
  395. &#39;regScope&#39;: &#39;BC&#39;,
  396. &#39;status&#39;: &#39;APPROVED&#39;,
  397. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  398. {&#39;state&#39;: &#39;Arkansas&#39;,
  399. &#39;regScope&#39;: &#39;BC&#39;,
  400. &#39;status&#39;: &#39;APPROVED&#39;,
  401. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  402. {&#39;state&#39;: &#39;California&#39;,
  403. &#39;regScope&#39;: &#39;BC&#39;,
  404. &#39;status&#39;: &#39;APPROVED&#39;,
  405. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  406. {&#39;state&#39;: &#39;Colorado&#39;,
  407. &#39;regScope&#39;: &#39;BC&#39;,
  408. &#39;status&#39;: &#39;APPROVED&#39;,
  409. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  410. {&#39;state&#39;: &#39;Connecticut&#39;,
  411. &#39;regScope&#39;: &#39;BC&#39;,
  412. &#39;status&#39;: &#39;APPROVED&#39;,
  413. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  414. {&#39;state&#39;: &#39;Delaware&#39;,
  415. &#39;regScope&#39;: &#39;BC&#39;,
  416. &#39;status&#39;: &#39;APPROVED&#39;,
  417. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  418. {&#39;state&#39;: &#39;District of Columbia&#39;,
  419. &#39;regScope&#39;: &#39;BC&#39;,
  420. &#39;status&#39;: &#39;APPROVED&#39;,
  421. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  422. {&#39;state&#39;: &#39;Florida&#39;,
  423. &#39;regScope&#39;: &#39;BC&#39;,
  424. &#39;status&#39;: &#39;APPROVED&#39;,
  425. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  426. {&#39;state&#39;: &#39;Georgia&#39;,
  427. &#39;regScope&#39;: &#39;BC&#39;,
  428. &#39;status&#39;: &#39;APPROVED&#39;,
  429. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  430. {&#39;state&#39;: &#39;Hawaii&#39;,
  431. &#39;regScope&#39;: &#39;BC&#39;,
  432. &#39;status&#39;: &#39;APPROVED&#39;,
  433. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  434. {&#39;state&#39;: &#39;Idaho&#39;,
  435. &#39;regScope&#39;: &#39;BC&#39;,
  436. &#39;status&#39;: &#39;APPROVED&#39;,
  437. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  438. {&#39;state&#39;: &#39;Illinois&#39;,
  439. &#39;regScope&#39;: &#39;BC&#39;,
  440. &#39;status&#39;: &#39;APPROVED&#39;,
  441. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  442. {&#39;state&#39;: &#39;Indiana&#39;,
  443. &#39;regScope&#39;: &#39;BC&#39;,
  444. &#39;status&#39;: &#39;APPROVED&#39;,
  445. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  446. {&#39;state&#39;: &#39;Iowa&#39;,
  447. &#39;regScope&#39;: &#39;BC&#39;,
  448. &#39;status&#39;: &#39;APPROVED&#39;,
  449. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  450. {&#39;state&#39;: &#39;Kansas&#39;,
  451. &#39;regScope&#39;: &#39;BC&#39;,
  452. &#39;status&#39;: &#39;APPROVED&#39;,
  453. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  454. {&#39;state&#39;: &#39;Kentucky&#39;,
  455. &#39;regScope&#39;: &#39;BC&#39;,
  456. &#39;status&#39;: &#39;APPROVED&#39;,
  457. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  458. {&#39;state&#39;: &#39;Louisiana&#39;,
  459. &#39;regScope&#39;: &#39;BC&#39;,
  460. &#39;status&#39;: &#39;APPROVED&#39;,
  461. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  462. {&#39;state&#39;: &#39;Maine&#39;,
  463. &#39;regScope&#39;: &#39;BC&#39;,
  464. &#39;status&#39;: &#39;APPROVED&#39;,
  465. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  466. {&#39;state&#39;: &#39;Maryland&#39;,
  467. &#39;regScope&#39;: &#39;BC&#39;,
  468. &#39;status&#39;: &#39;APPROVED&#39;,
  469. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  470. {&#39;state&#39;: &#39;Massachusetts&#39;,
  471. &#39;regScope&#39;: &#39;BC&#39;,
  472. &#39;status&#39;: &#39;APPROVED&#39;,
  473. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  474. {&#39;state&#39;: &#39;Michigan&#39;,
  475. &#39;regScope&#39;: &#39;BC&#39;,
  476. &#39;status&#39;: &#39;APPROVED&#39;,
  477. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  478. {&#39;state&#39;: &#39;Minnesota&#39;,
  479. &#39;regScope&#39;: &#39;BC&#39;,
  480. &#39;status&#39;: &#39;APPROVED&#39;,
  481. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  482. {&#39;state&#39;: &#39;Mississippi&#39;,
  483. &#39;regScope&#39;: &#39;BC&#39;,
  484. &#39;status&#39;: &#39;APPROVED&#39;,
  485. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  486. {&#39;state&#39;: &#39;Missouri&#39;,
  487. &#39;regScope&#39;: &#39;BC&#39;,
  488. &#39;status&#39;: &#39;APPROVED&#39;,
  489. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  490. {&#39;state&#39;: &#39;Montana&#39;,
  491. &#39;regScope&#39;: &#39;BC&#39;,
  492. &#39;status&#39;: &#39;APPROVED&#39;,
  493. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  494. {&#39;state&#39;: &#39;Nebraska&#39;,
  495. &#39;regScope&#39;: &#39;BC&#39;,
  496. &#39;status&#39;: &#39;APPROVED&#39;,
  497. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  498. {&#39;state&#39;: &#39;Nevada&#39;,
  499. &#39;regScope&#39;: &#39;BC&#39;,
  500. &#39;status&#39;: &#39;APPROVED&#39;,
  501. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  502. {&#39;state&#39;: &#39;New Hampshire&#39;,
  503. &#39;regScope&#39;: &#39;BC&#39;,
  504. &#39;status&#39;: &#39;APPROVED&#39;,
  505. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  506. {&#39;state&#39;: &#39;New Jersey&#39;,
  507. &#39;regScope&#39;: &#39;BC&#39;,
  508. &#39;status&#39;: &#39;APPROVED&#39;,
  509. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  510. {&#39;state&#39;: &#39;New Mexico&#39;,
  511. &#39;regScope&#39;: &#39;BC&#39;,
  512. &#39;status&#39;: &#39;APPROVED&#39;,
  513. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  514. {&#39;state&#39;: &#39;New York&#39;,
  515. &#39;regScope&#39;: &#39;BC&#39;,
  516. &#39;status&#39;: &#39;APPROVED&#39;,
  517. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  518. {&#39;state&#39;: &#39;North Carolina&#39;,
  519. &#39;regScope&#39;: &#39;BC&#39;,
  520. &#39;status&#39;: &#39;APPROVED&#39;,
  521. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  522. {&#39;state&#39;: &#39;North Dakota&#39;,
  523. &#39;regScope&#39;: &#39;BC&#39;,
  524. &#39;status&#39;: &#39;APPROVED&#39;,
  525. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  526. {&#39;state&#39;: &#39;Ohio&#39;,
  527. &#39;regScope&#39;: &#39;BC&#39;,
  528. &#39;status&#39;: &#39;APPROVED&#39;,
  529. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  530. {&#39;state&#39;: &#39;Oklahoma&#39;,
  531. &#39;regScope&#39;: &#39;BC&#39;,
  532. &#39;status&#39;: &#39;APPROVED&#39;,
  533. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  534. {&#39;state&#39;: &#39;Oregon&#39;,
  535. &#39;regScope&#39;: &#39;BC&#39;,
  536. &#39;status&#39;: &#39;APPROVED&#39;,
  537. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  538. {&#39;state&#39;: &#39;Pennsylvania&#39;,
  539. &#39;regScope&#39;: &#39;BC&#39;,
  540. &#39;status&#39;: &#39;APPROVED&#39;,
  541. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  542. {&#39;state&#39;: &#39;Puerto Rico&#39;,
  543. &#39;regScope&#39;: &#39;BC&#39;,
  544. &#39;status&#39;: &#39;APPROVED&#39;,
  545. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  546. {&#39;state&#39;: &#39;Rhode Island&#39;,
  547. &#39;regScope&#39;: &#39;BC&#39;,
  548. &#39;status&#39;: &#39;APPROVED&#39;,
  549. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  550. {&#39;state&#39;: &#39;South Carolina&#39;,
  551. &#39;regScope&#39;: &#39;BC&#39;,
  552. &#39;status&#39;: &#39;APPROVED&#39;,
  553. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  554. {&#39;state&#39;: &#39;South Dakota&#39;,
  555. &#39;regScope&#39;: &#39;BC&#39;,
  556. &#39;status&#39;: &#39;APPROVED&#39;,
  557. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  558. {&#39;state&#39;: &#39;Tennessee&#39;,
  559. &#39;regScope&#39;: &#39;BC&#39;,
  560. &#39;status&#39;: &#39;APPROVED&#39;,
  561. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  562. {&#39;state&#39;: &#39;Texas&#39;,
  563. &#39;regScope&#39;: &#39;BC&#39;,
  564. &#39;status&#39;: &#39;APPROVED&#39;,
  565. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  566. {&#39;state&#39;: &#39;Texas&#39;,
  567. &#39;regScope&#39;: &#39;IA&#39;,
  568. &#39;status&#39;: &#39;APPROVED_RES&#39;,
  569. &#39;regDate&#39;: &#39;7/13/2018&#39;},
  570. {&#39;state&#39;: &#39;Utah&#39;,
  571. &#39;regScope&#39;: &#39;BC&#39;,
  572. &#39;status&#39;: &#39;APPROVED&#39;,
  573. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  574. {&#39;state&#39;: &#39;Utah&#39;,
  575. &#39;regScope&#39;: &#39;IA&#39;,
  576. &#39;status&#39;: &#39;APPROVED&#39;,
  577. &#39;regDate&#39;: &#39;7/13/2018&#39;},
  578. {&#39;state&#39;: &#39;Vermont&#39;,
  579. &#39;regScope&#39;: &#39;BC&#39;,
  580. &#39;status&#39;: &#39;APPROVED&#39;,
  581. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  582. {&#39;state&#39;: &#39;Virginia&#39;,
  583. &#39;regScope&#39;: &#39;BC&#39;,
  584. &#39;status&#39;: &#39;APPROVED&#39;,
  585. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  586. {&#39;state&#39;: &#39;Washington&#39;,
  587. &#39;regScope&#39;: &#39;BC&#39;,
  588. &#39;status&#39;: &#39;APPROVED&#39;,
  589. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  590. {&#39;state&#39;: &#39;West Virginia&#39;,
  591. &#39;regScope&#39;: &#39;BC&#39;,
  592. &#39;status&#39;: &#39;APPROVED&#39;,
  593. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  594. {&#39;state&#39;: &#39;Wisconsin&#39;,
  595. &#39;regScope&#39;: &#39;BC&#39;,
  596. &#39;status&#39;: &#39;APPROVED&#39;,
  597. &#39;regDate&#39;: &#39;1/1/2008&#39;},
  598. {&#39;state&#39;: &#39;Wyoming&#39;,
  599. &#39;regScope&#39;: &#39;BC&#39;,
  600. &#39;status&#39;: &#39;APPROVED&#39;,
  601. &#39;regDate&#39;: &#39;1/1/2008&#39;}],
  602. &#39;registeredSROs&#39;: [{&#39;sro&#39;: &#39;FINRA&#39;, &#39;status&#39;: &#39;APPROVED&#39;},
  603. {&#39;sro&#39;: &#39;New York Stock Exchange&#39;, &#39;status&#39;: &#39;APPROVED&#39;}],
  604. &#39;brokerDetails&#39;: {&#39;hasBCComments&#39;: &#39;N&#39;,
  605. &#39;hasIAComments&#39;: &#39;N&#39;,
  606. &#39;legacyReportStatusDescription&#39;: &#39;Not Requested&#39;}}
  607. What I have tried to do is to implement JSON normalize and JSON flatten. I have modified the code like this for person 1 and person 2
  608. import pandas as pds
  609. from flatten_json import flatten
  610. import json
  611. #person_json is what I stored each person JSON. There are 2
  612. #persons here. Thus, I do this two times to flatten the nested
  613. #dictionary.
  614. person_temp = pds.json_normalize(flatten(person_json))
  615. # This line of the code is credited to Mr.Timeless
  616. data_frame = (person_temp.set_axis(person_temp.columns.str.split(&quot;_&quot;, n=1,
  617. expand=True), axis=1).stack(1).droplevel(0))
  618. data_frame
  619. Edited 1: Adding the captured photo of data_frame
  620. The sample data_frame looks like this. I show only some parts of data_frame because the dimension is equal to 111 rows-by-16 columns.
  621. [![enter image description here][2]][2]
  622. What I get from the above code is a data frame. However, I try to manage to construct the panel data like the first captured photo that I presented. The issue I found here is to extract &#39;Year&#39; and &#39;City&#39; and to construct them into the (unbalanced) panel data set.
  623. How should I do this?
  624. Any suggestions/comments are welcome.
  625. Thank you very much
  626. [1]: https://i.stack.imgur.com/QQjPP.png
  627. [2]: https://i.stack.imgur.com/Wkr1a.png
  628. </details>
  629. # 答案1
  630. **得分**: 1
  631. 我建议采用不同的方法
  632. 首先定义以下辅助函数
  633. ```python
  634. import pandas as pd
  635. def flatten(data, new_data):
  636. for key, value in data.items():
  637. if isinstance(value, dict):
  638. flatten(value, new_data)
  639. if isinstance(value, str) or isinstance(value, int) or isinstance(value, list):
  640. new_data[key] = value
  641. return new_data
  642. def deal_with_dicts(df, columns):
  643. for col in columns:
  644. df = pd.concat([df, pd.json_normalize(df[col])], axis=1)
  645. df = df.drop(columns=col)
  646. return df
  647. def deal_with_duplicated_column_names(df):
  648. duplicates = {k: 1 for k in df.columns}
  649. new_cols = []
  650. for col in df.columns:
  651. if col in new_cols:
  652. new_cols.append(col + f"_{duplicates[col]}")
  653. duplicates[col] += 1
  654. else:
  655. new_cols.append(col)
  656. df.columns = new_cols
  657. return df

然后:

  1. from collections import defaultdict
  2. person1_data = flatten(person1, defaultdict(list))
  3. df = pd.json_normalize(person1_data)
  4. # ROUND 1
  5. for col in df.columns:
  6. df = df.explode(col) # 处理包含字典列表的列
  7. df = df.reset_index(drop=True)
  8. df = deal_with_dicts(
  9. df,
  10. [
  11. "currentEmployments",
  12. "currentIAEmployments",
  13. "stateExamCategory",
  14. "productExamCategory",
  15. "registeredStates",
  16. "registeredSROs",
  17. ],
  18. )
  19. df = deal_with_duplicated_column_names(df)
  20. # ROUND 2
  21. for col in df.columns:
  22. df = df.explode(col) # 处理包含字典列表的列
  23. df = df.reset_index(drop=True)
  24. df = deal_with_dicts(df, ["branchOfficeLocations", "branchOfficeLocations_1"])
  25. df = deal_with_duplicated_column_names(df)
  26. # ROUND 3
  27. for col in df.columns:
  28. df = df.explode(col) # 处理包含字典列表的列
  29. df = df.reset_index(drop=True)

这将为您提供来自 person1 字典的所有数据,并将其展平为一个数据框:

  1. print(df.info())
  2. # 输出结果
  3. [38880 x 88 列]
  4. <class 'pandas.core.frame.DataFrame'>
  5. RangeIndex: 38880 entries, 0 to 38879
  6. Data columns (total 88 columns):
  7. # Column Non-Null Count Dtype
  8. --- ------ -------------- -----
  9. 0 individualId 38880 non-null int64
  10. 1 firstName 38880 non-null object
  11. 2 middleName 38880 non-null object
  12. 3 lastName 38880 non-null object
  13. 4 otherNames 38880 non-null object
  14. ...
  15. # 其他列信息
  16. ...
  17. 87 elaBeginDate_1 38880 non-null object
  18. dtypes: int64(10), object(78)
  19. memory usage: 26.1+ MB
英文:

I suggest a different approach.

First, define the following helper functions:

  1. import pandas as pd
  2. def flatten(data, new_data):
  3. for key, value in data.items():
  4. if isinstance(value, dict):
  5. flatten(value, new_data)
  6. if isinstance(value, str) or isinstance(value, int) or isinstance(value, list):
  7. new_data[key] = value
  8. return new_data
  9. def deal_with_dicts(df, columns):
  10. for col in columns:
  11. df = pd.concat([df, pd.json_normalize(df[col])], axis=1)
  12. df = df.drop(columns=col)
  13. return df
  14. def deal_with_duplicated_column_names(df):
  15. duplicates = {k: 1 for k in df.columns}
  16. new_cols = []
  17. for col in df.columns:
  18. if col in new_cols:
  19. new_cols.append(col + f&quot;_{duplicates[col]}&quot;)
  20. duplicates[col] += 1
  21. else:
  22. new_cols.append(col)
  23. df.columns = new_cols
  24. return df

Then:

  1. from collections import defaultdict
  2. person1_data = flatten(person1, defaultdict(list))
  3. df = pd.json_normalize(person1_data)
  4. # ROUND 1
  5. for col in df.columns:
  6. df = df.explode(col) # Deal with lists of dicts
  7. df = df.reset_index(drop=True)
  8. df = deal_with_dicts(
  9. df,
  10. [
  11. &quot;currentEmployments&quot;,
  12. &quot;currentIAEmployments&quot;,
  13. &quot;stateExamCategory&quot;,
  14. &quot;productExamCategory&quot;,
  15. &quot;registeredStates&quot;,
  16. &quot;registeredSROs&quot;,
  17. ],
  18. )
  19. df = deal_with_duplicated_column_names(df)
  20. # ROUND 2
  21. for col in df.columns:
  22. df = df.explode(col) # Deal with lists of dicts
  23. df = df.reset_index(drop=True)
  24. df = deal_with_dicts(df, [&quot;branchOfficeLocations&quot;, &quot;branchOfficeLocations_1&quot;])
  25. df = deal_with_duplicated_column_names(df)
  26. # ROUND 3
  27. for col in df.columns:
  28. df = df.explode(col) # Deal with lists of dicts
  29. df = df.reset_index(drop=True)

Which gives you all the data from person1 dictionary as a flattened dataframe:

  1. print(df.info())
  2. # Output
  3. [38880 rows x 88 columns]
  4. &lt;class &#39;pandas.core.frame.DataFrame&#39;&gt;
  5. RangeIndex: 38880 entries, 0 to 38879
  6. Data columns (total 88 columns):
  7. # Column Non-Null Count Dtype
  8. --- ------ -------------- -----
  9. 0 individualId 38880 non-null int64
  10. 1 firstName 38880 non-null object
  11. 2 middleName 38880 non-null object
  12. 3 lastName 38880 non-null object
  13. 4 otherNames 38880 non-null object
  14. 5 bcScope 38880 non-null object
  15. 6 iaScope 38880 non-null object
  16. 7 daysInIndustryCalculatedDate 38880 non-null object
  17. 8 previousEmployments 0 non-null object
  18. 9 previousIAEmployments 0 non-null object
  19. 10 disclosureFlag 38880 non-null object
  20. 11 iaDisclosureFlag 38880 non-null object
  21. 12 disclosures 0 non-null object
  22. 13 stateExamCount 38880 non-null int64
  23. 14 principalExamCount 38880 non-null int64
  24. 15 productExamCount 38880 non-null int64
  25. 16 principalExamCategory 0 non-null object
  26. 17 approvedSRORegistrationCount 38880 non-null int64
  27. 18 approvedFinraRegistrationCount 38880 non-null int64
  28. 19 approvedStateRegistrationCount 38880 non-null int64
  29. 20 approvedIAStateRegistrationCount 38880 non-null int64
  30. 21 hasBCComments 38880 non-null object
  31. 22 hasIAComments 38880 non-null object
  32. 23 legacyReportStatusDescription 38880 non-null object
  33. 24 firmId 38880 non-null int64
  34. 25 firmName 38880 non-null object
  35. 26 iaOnly 38880 non-null object
  36. 27 registrationBeginDate 38880 non-null object
  37. 28 firmBCScope 38880 non-null object
  38. 29 firmIAScope 38880 non-null object
  39. 30 iaSECNumber 38880 non-null object
  40. 31 iaSECNumberType 38880 non-null object
  41. 32 bdSECNumber 38880 non-null object
  42. 33 firmId_1 38880 non-null int64
  43. 34 firmName_1 38880 non-null object
  44. 35 iaOnly_1 38880 non-null object
  45. 36 registrationBeginDate_1 38880 non-null object
  46. 37 firmBCScope_1 38880 non-null object
  47. 38 firmIAScope_1 38880 non-null object
  48. 39 iaSECNumber_1 38880 non-null object
  49. 40 iaSECNumberType_1 38880 non-null object
  50. 41 bdSECNumber_1 38880 non-null object
  51. 42 examCategory 38880 non-null object
  52. 43 examName 38880 non-null object
  53. 44 examTakenDate 38880 non-null object
  54. 45 examScope 38880 non-null object
  55. 46 examCategory_1 38880 non-null object
  56. 47 examName_1 38880 non-null object
  57. 48 examTakenDate_1 38880 non-null object
  58. 49 examScope_1 38880 non-null object
  59. 50 state 38880 non-null object
  60. 51 regScope 38880 non-null object
  61. 52 status 38880 non-null object
  62. 53 regDate 38880 non-null object
  63. 54 sro 38880 non-null object
  64. 55 status_1 38880 non-null object
  65. 56 locatedAtFlag 38880 non-null object
  66. 57 supervisedFromFlag 38880 non-null object
  67. 58 privateResidenceFlag 38880 non-null object
  68. 59 branchOfficeId 38880 non-null object
  69. 60 street1 38880 non-null object
  70. 61 street2 38880 non-null object
  71. 62 city 38880 non-null object
  72. 63 cityAlias 38880 non-null object
  73. 64 state_1 38880 non-null object
  74. 65 country 38880 non-null object
  75. 66 zipCode 38880 non-null object
  76. 67 latitude 38880 non-null object
  77. 68 longitude 38880 non-null object
  78. 69 geoLocation 38880 non-null object
  79. 70 nonRegisteredOfficeFlag 38880 non-null object
  80. 71 elaBeginDate 38880 non-null object
  81. 72 locatedAtFlag_1 38880 non-null object
  82. 73 supervisedFromFlag_1 38880 non-null object
  83. 74 privateResidenceFlag_1 38880 non-null object
  84. 75 branchOfficeId_1 38880 non-null object
  85. 76 street1_1 38880 non-null object
  86. 77 street2_1 38880 non-null object
  87. 78 city_1 38880 non-null object
  88. 79 cityAlias_1 38880 non-null object
  89. 80 state_2 38880 non-null object
  90. 81 country_1 38880 non-null object
  91. 82 zipCode_1 38880 non-null object
  92. 83 latitude_1 38880 non-null object
  93. 84 longitude_1 38880 non-null object
  94. 85 geoLocation_1 38880 non-null object
  95. 86 nonRegisteredOfficeFlag_1 38880 non-null object
  96. 87 elaBeginDate_1 38880 non-null object
  97. dtypes: int64(10), object(78)
  98. memory usage: 26.1+ MB

huangapple
  • 本文由 发表于 2023年6月2日 14:17:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387591.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定