Message Boards Message Boards

0
|
2406 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Replacing DeleteMissing while maintaining columns in Grid?

Posted 2 years ago

List

llc = {Entity["Company", "Moderna::6dvsm"], 
   Entity["Company", "NVIDIACorporation::7ymsk"],  
   Entity["Company", "Square::xx7qd"], 
   Entity["Company", "TeslaMotors::tpbn5"], 
   Entity["Company", "UpstartHoldings::g9csn"], 
   Entity["Company", "ZoomVideoCommunications::3y89f"], 
   Entity["Company", "Zscaler::9vw54"]} ; 

Data from CompanyDate which has a lot of missing information

cdata = CompanyData[
  llc, {"Name" , "CurrentRatio" , "Employees" , 
   "FinancialHealthGrade", "ProfitabilityGrade"  , "RevenueGrowth" , 
   "NetIncomeGrowth" , "OperatingIncomeGrowth"}]  

Deletion of missing information and results -- output does not display well so posted picture instead

In[222]:= cdata1 =  Grid[DeleteMissing[cdata , All ], Frame -> All]

enter image description here

Because of the deleted missing information, data jumps columns. How can I maintain column integrity??

POSTED BY: Raymond Low
Posted 2 years ago

Replace with something, using "-" here, you can use "NA" or whatever.

props = {"Name", "CurrentRatio", "Employees", "FinancialHealthGrade", 
  "ProfitabilityGrade" , "RevenueGrowth", "NetIncomeGrowth", "OperatingIncomeGrowth"};
cdata = CompanyData[llc, props];

cdata /. _Missing -> "-" // Prepend[props] // 
 Grid[#, Frame -> All, Background -> {Automatic, {1 -> LightYellow}}, 
   ItemStyle -> {Automatic, {1 -> Bold}}] &

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract