CountRows - Maple Help

DataSets[Builtin][Reference]

 GetName
 obtain a short name of a reference
 GetIdentifier
 obtain the identifier for a reference
 GetDescription
 obtain a description of a reference
 GetElementNames
 obtain the row names of a reference
 CountRows
 obtain the number of rows of a reference
 obtain the column names of a reference
 GetData
 obtain the data of a reference

 Calling Sequence GetName(ref) GetDescription(ref) GetElementNames(ref) CountRows(ref) GetHeaders(ref) GetData(ref)

Parameters

 ref - reference to built-in data

GetName

 • Returns the name of the reference as a string. This is a short string description of the data set. If you create a subset of a data set by using indexing, the name may change if the result has only a single (non-name) column or a single row.

GetDescription

 • Returns a string description of the data set. If you create a subset of a data set by using indexing, the description may change if the result has only a single (non-name) column or a single row.

GetIdentifier

 • Returns the identifier of a reference as a string. This is a unique identifier that can be used to find this reference among the built-in data sets.

GetElementNames

 • Returns a list of strings which are the names of the rows in the reference. Each row name is unique in the containing data set. This command may be slow if used on the full GeoNames data set.

CountRows

 • Returns the total number of rows in the reference in a efficient manner.

 • Returns a list of strings which are the names of the columns in the reference. Each column name is unique in the containing data set.

GetData

 • Returns the reference as a Matrix, without the column headers and without the row names. This command will retrieve all metadata, which may be slow if used on a large data set.

Examples

 > $\mathrm{with}\left(\mathrm{DataSets}\right):$
 > $\mathrm{ref}≔\mathrm{Reference}\left("Builtin","Country"\right)$
 ${\mathrm{ref}}{≔}\left[\begin{array}{ccccc}{\mathrm{Country \left(Name\right)}}& {\mathrm{CO2 Emissions}}& {\mathrm{CPI Change}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {\mathrm{\left(124 more\right)}}\\ {\mathrm{Afghanistan}}& {\mathrm{TimeSeries 9809.225}}& {\mathrm{TimeSeries 4.9759515055383}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Albania}}& {\mathrm{TimeSeries 5716.853}}& {\mathrm{TimeSeries 1.41109078954244}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Algeria}}& {\mathrm{TimeSeries 145400.217}}& {\mathrm{TimeSeries 1.95176821052894}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\ddots }\right]\right)& {}\\ {\mathrm{\left(182 more\right)}}& {}& {}& {}& {}\end{array}\right]$ (1)
 > $\mathrm{GetIdentifier}\left(\mathrm{ref}\right)$
 ${"Country"}$ (2)
 > $\mathrm{GetName}\left(\mathrm{ref}\right)$
 ${"Country properties"}$ (3)
 > $\mathrm{GetDescription}\left(\mathrm{ref}\right)$
 ${"A table of country properties, containing immediate values for some properties and references to time series data \left(from Quandl\right) for others."}$ (4)
 > $\mathrm{GetElementNames}\left(\mathrm{ref}\right)$
 $\left[{"Afghanistan"}{,}{"Albania"}{,}{"Algeria"}{,}{"Angola"}{,}{"Antigua and Barbuda"}{,}{"Argentina"}{,}{"Armenia"}{,}{"Australia"}{,}{"Austria"}{,}{"Azerbaijan"}{,}{"Bahrain"}{,}{"Bangladesh"}{,}{"Barbados"}{,}{"Belarus"}{,}{"Belgium"}{,}{"Belize"}{,}{"Benin"}{,}{"Bhutan"}{,}{"Bolivia"}{,}{"Bosnia and Herzegovina"}{,}{"Botswana"}{,}{"Brazil"}{,}{"Brunei"}{,}{"Bulgaria"}{,}{"Burkina Faso"}{,}{"Burundi"}{,}{"Cabo Verde"}{,}{"Cambodia"}{,}{"Cameroon"}{,}{"Canada"}{,}{"Central African Republic"}{,}{"Chad"}{,}{"Chile"}{,}{"China"}{,}{"Colombia"}{,}{"Comoros"}{,}{"Congo"}{,}{"Congo-Brazzaville"}{,}{"Costa Rica"}{,}{"Croatia"}{,}{"Cuba"}{,}{"Cyprus"}{,}{"Czech Republic"}{,}{"Denmark"}{,}{"Djibouti"}{,}{"Dominica"}{,}{"Dominican Republic"}{,}{"Ecuador"}{,}{"Egypt"}{,}{"El Salvador"}{,}{"Equatorial Guinea"}{,}{"Eritrea"}{,}{"Estonia"}{,}{"Ethiopia"}{,}{"Fiji"}{,}{"Finland"}{,}{"France"}{,}{"Gabon"}{,}{"Gambia"}{,}{"Georgia"}{,}{"Germany"}{,}{"Ghana"}{,}{"Greece"}{,}{"Grenada"}{,}{"Guatemala"}{,}{"Guinea"}{,}{"Guinea-Bissau"}{,}{"Guyana"}{,}{"Haiti"}{,}{"Honduras"}{,}{"Hong Kong"}{,}{"Hungary"}{,}{"Iceland"}{,}{"India"}{,}{"Indonesia"}{,}{"Iran"}{,}{"Iraq"}{,}{"Ireland"}{,}{"Israel"}{,}{"Italy"}{,}{"Ivory Coast"}{,}{"Jamaica"}{,}{"Japan"}{,}{"Jordan"}{,}{"Kazakhstan"}{,}{"Kenya"}{,}{"Kiribati"}{,}{"Kosovo"}{,}{"Kuwait"}{,}{"Kyrgyzstan"}{,}{"Laos"}{,}{"Latvia"}{,}{"Lebanon"}{,}{"Lesotho"}{,}{"Liberia"}{,}{"Libya"}{,}{"Lithuania"}{,}{"Luxembourg"}{,}{"Macedonia"}{,}{"Madagascar"}{,}{"Malawi"}{,}{"Malaysia"}{,}{"Maldives"}{,}{"Mali"}{,}{"Malta"}{,}{"Mauritania"}{,}{"Mauritius"}{,}{"Mexico"}{,}{"Moldova"}{,}{"Mongolia"}{,}{"Montenegro"}{,}{"Morocco"}{,}{"Mozambique"}{,}{"Myanmar"}{,}{"Namibia"}{,}{"Nepal"}{,}{"Netherlands"}{,}{"New Zealand"}{,}{"Nicaragua"}{,}{"Niger"}{,}{"Nigeria"}{,}{"Norway"}{,}{"Oman"}{,}{"Pakistan"}{,}{"Panama"}{,}{"Papua New Guinea"}{,}{"Paraguay"}{,}{"Peru"}{,}{"Philippines"}{,}{"Poland"}{,}{"Portugal"}{,}{"Qatar"}{,}{"Romania"}{,}{"Russia"}{,}{"Rwanda"}{,}{"Saint Lucia"}{,}{"Samoa"}{,}{"Sao Tome and Principe"}{,}{"Saudi Arabia"}{,}{"Senegal"}{,}{"Serbia"}{,}{"Seychelles"}{,}{"Sierra Leone"}{,}{"Singapore"}{,}{"Slovakia"}{,}{"Slovenia"}{,}{"Solomon Islands"}{,}{"Somalia"}{,}{"South Africa"}{,}{"South Korea"}{,}{"South Sudan"}{,}{"Spain"}{,}{"Sri Lanka"}{,}{"Sudan"}{,}{"Suriname"}{,}{"Swaziland"}{,}{"Sweden"}{,}{"Switzerland"}{,}{"Syria"}{,}{"Taiwan"}{,}{"Tajikistan"}{,}{"Tanzania"}{,}{"Thailand"}{,}{"The Bahamas"}{,}{"Timor-Leste"}{,}{"Togo"}{,}{"Tonga"}{,}{"Trinidad and Tobago"}{,}{"Tunisia"}{,}{"Turkey"}{,}{"Turkmenistan"}{,}{"Tuvalu"}{,}{"UAE"}{,}{"UK"}{,}{"USA"}{,}{"Uganda"}{,}{"Ukraine"}{,}{"Uruguay"}{,}{"Uzbekistan"}{,}{"Vanuatu"}{,}{"Venezuela"}{,}{"Vietnam"}{,}{"Yemen"}{,}{"Zambia"}{,}{"Zimbabwe"}\right]$ (5)
 > $\mathrm{CountRows}\left(\mathrm{ref}\right)$
 ${185}$ (6)
 > $\mathrm{GetHeaders}\left(\mathrm{ref}\right)$
 $\left[{"CO2 Emissions"}{,}{"CPI Change"}{,}{"Child Mortality"}{,}{"Currency Code"}{,}{"Fertility Rate"}{,}{"GDP - LCU"}{,}{"GDP - USD"}{,}{"GDP Deflator"}{,}{"Gini Index"}{,}{"Internet Users"}{,}{"Net Debt"}{,}{"Population"}{,}{"Real GDP - LCU"}{,}{"Real GDP Change"}{,}{"Adult Literacy Rate"}{,}{"Adults Living with HIV"}{,}{"Armed Forces Personnel"}{,}{"Cell Phone Subscribers"}{,}{"Commercial Tax Rate"}{,}{"Exports Share of GDP"}{,}{"Female Population"}{,}{"Government Revenues"}{,}{"Government Spending"}{,}{"Gross Production"}{,}{"Human Development Index"}{,}{"Imports Share of GDP"}{,}{"Industry Share of GDP"}{,}{"Low Birth-Weight Babies"}{,}{"Methane Emissions"}{,}{"Military Expenditures"}{,}{"Nurses per 1000 People"}{,}{"Passenger Vehicles"}{,}{"Population Above Age 64"}{,}{"Population Below Age 15"}{,}{"Population Density"}{,}{"Population Growth Rate"}{,}{"Primary Enrolment Rate"}{,}{"Rural Population"}{,}{"Services Share of GDP"}{,}{"Stock Market Index"}{,}{"Surplus or Deficit"}{,}{"Tertiary Enrolment Rate"}{,}{"Under-Nourished People"}{,}{"Unemployment Rate"}{,}{"Urban Population"}{,}{"Youth Literacy Rate"}{,}{"Agriculture Share of Employment"}{,}{"Agriculture Share of GDP"}{,}{"Deaths From Injury and Accident"}{,}{"Female-Male Literacy Ratio"}{,}{"Gross Inland Availability"}{,}{"Health Expenditure Per Capita"}{,}{"Household Electrification Rate"}{,}{"Industry Share of Employment"}{,}{"International Tourism Arrivals"}{,}{"Life Expectancy at Birth"}{,}{"Nominal USD Exchange Rate"}{,}{"Population Aged 15 to 64"}{,}{"Secondary Enrolment Rate"}{,}{"Services Share of Employment"}{,}{"Stock Market Capitalization"}{,}{"Urban Population in Slums"}{,}{"Access to Improved Water Sources"}{,}{"Deaths From Disease and Nutrition"}{,}{"Deaths From Non-Communicable Diseases"}{,}{"Access to Improved Sanitation Facilities"}{,}{"Population Affected by Droughts or Floods"}{,}{"Population Living with Less than Five Dollars a Day"}{,}{"2 Letter Country Code"}{,}{"Country Code for Internet Top-Level Domain"}{,}{"3 Letter Country Code"}{,}{"Heliports"}{,}{"Children under the age of 5 years underweight \left(%\right)"}{,}{"Military expenditures \left(% GDP\right)"}{,}{"Contraceptive prevalence rate \left(%\right)"}{,}{"Gross national saving \left(% GDP\right)"}{,}{"Public debt \left(% GDP\right)"}{,}{"Total renewable water resources"}{,}{"Health expenditures \left(% GDP\right)"}{,}{"Obesity - adult prevalence rate \left(%\right)"}{,}{"Hospital bed density / 1000 pop"}{,}{"Physicians density / 1000 pop"}{,}{"Education expenditures \left(% GDP\right)"}{,}{"Electricity - from other renewable sources \left(%\right)"}{,}{"Electricity - from fossil fuels \left(%\right)"}{,}{"Electricity - from nuclear fuels \left(%\right)"}{,}{"Electricity - from hydroelectric plants \left(%\right)"}{,}{"Crude oil - exports"}{,}{"Crude oil - imports"}{,}{"Crude oil - production"}{,}{"Refined petroleum products - exports"}{,}{"Carbon dioxide emissions from consumption of energy"}{,}{"Electricity - installed generating capacity"}{,}{"Refined petroleum products - production"}{,}{"Refined petroleum products - consumption"}{,}{"Refined petroleum products - imports"}{,}{"Natural gas - exports"}{,}{"Natural gas - imports"}{,}{"Natural gas - production"}{,}{"Natural gas - consumption"}{,}{"Natural gas - proved reserves"}{,}{"Crude oil - proved reserves"}{,}{"Electricity - exports"}{,}{"Taxes and other revenues \left(% GDP\right)"}{,}{"Electricity - imports"}{,}{"Telephones - mobile cellular"}{,}{"Budget surplus \left(+\right) or deficit \left(-\right) \left(% GDP\right)"}{,}{"Electricity - production"}{,}{"Electricity - consumption"}{,}{"Telephones - main lines in use"}{,}{"Net migration rate / 1000 pop / year"}{,}{"Industrial production growth rate \left(%\right)"}{,}{"Death rate / 1000 pop / year"}{,}{"Birth rate / 1000 pop / year"}{,}{"Unemployment rate \left(%\right)"}{,}{"Inflation rate \left(consumer prices\right) \left(% / year\right)"}{,}{"Total fertility rate \left(children / woman\right)"}{,}{"HIV/AIDS - adult prevalence rate"}{,}{"HIV/AIDS - deaths / year"}{,}{"Internet hosts"}{,}{"Population growth rate \left(% / year\right)"}{,}{"Labor force"}{,}{"Airports"}{,}{"Irrigated land"}{,}{"Land boundaries"}{,}{"Coastline"}\right]$ (7)
 > $\mathrm{GetData}\left({\mathrm{ref}}_{1..2,1..2}\right)$
 $\left[\begin{array}{cc}\left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{CO2 emissions \left(kt\right) - Afghanistan}}\\ {\mathrm{Quandl WWDI/AFG_EN_ATM_CO2E_KT}}\\ {\mathrm{up to 65 rows \left(annual\right), 1 column}}\\ {\mathrm{1950-12-31 - 2014-12-31}}\end{array}\right]& \left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{Inflation, consumer prices \left(annual %\right) - Afghanistan}}\\ {\mathrm{Quandl WWDI/AFG_FP_CPI_TOTL_ZG}}\\ {\mathrm{up to 13 rows \left(annual\right), 1 column}}\\ {\mathrm{2005-12-31 - 2017-12-31}}\end{array}\right]\\ \left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{CO2 emissions \left(kt\right) - Albania}}\\ {\mathrm{Quandl WWDI/ALB_EN_ATM_CO2E_KT}}\\ {\mathrm{up to 65 rows \left(annual\right), 1 column}}\\ {\mathrm{1950-12-31 - 2014-12-31}}\end{array}\right]& \left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{Inflation, consumer prices \left(annual %\right) - Albania}}\\ {\mathrm{Quandl WWDI/ALB_FP_CPI_TOTL_ZG}}\\ {\mathrm{up to 28 rows \left(annual\right), 1 column}}\\ {\mathrm{1992-12-31 - 2019-12-31}}\end{array}\right]\end{array}\right]$ (8)

Create a reference to the GeoNames data set.

 > $\mathrm{refg}≔\mathrm{Builtin}:-\mathrm{Reference}\left("Geonames"\right)$
 ${\mathrm{refg}}{≔}\left[\begin{array}{ccccc}{\mathrm{Geonames \left(GeoNamesid\right)}}& {\mathrm{Name}}& {\mathrm{Type}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {\mathrm{\left(7 more\right)}}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{68}}\right]\right)& {\mathrm{Boneh-ye Mehdi}}& {"section of populated place"}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{121}}\right]\right)& {\mathrm{Lab Sefid}}& {"locality"}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{166}}\right]\right)& {\mathrm{Gorizi}}& {"locality"}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{⋮}\right]\right)& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\ddots }\right]\right)& {}\\ {\mathrm{\left(1155858 more\right)}}& {}& {}& {}& {}\end{array}\right]$ (9)

Count the number of rows in the GeoNames data set:

 > $\mathrm{CountRows}\left(\mathrm{refg}\right)$
 ${1155861}$ (10)

Available data variables in the GeoNames data set include:

 > $\mathrm{GetHeaders}\left(\mathrm{refg}\right)$
 $\left[{"Name"}{,}{"Type"}{,}{"Latitude"}{,}{"Longitude"}{,}{"Country"}{,}{"Province/State/Region"}{,}{"City/County"}{,}{"Population"}{,}{"Time Zone"}\right]$ (11)

 > $\mathrm{Waterloo_Data}≔{\mathrm{refg}}_{\left[\mathrm{Country}="Canada",\mathrm{Type}="populated place",1000<\mathrm{Population},\mathrm{Name}="Waterloo"\right]}$
 ${\mathrm{Waterloo_Data}}{≔}\left[\begin{array}{ccccc}{\mathrm{Geonames \left(GeoNamesid\right)}}& {\mathrm{Name}}& {\mathrm{Type}}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {\mathrm{\left(7 more\right)}}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{6176821}}\right]\right)& {\mathrm{Waterloo}}& {"populated place"}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{6176823}}\right]\right)& {\mathrm{Waterloo}}& {"populated place"}& {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\dots }\right]\right)& {}\end{array}\right]$ (12)

Return the all of the data from the search above:

 > $\mathrm{GetData}\left(\mathrm{Waterloo_Data}\right)$
 $\left[\begin{array}{ccccccccc}{"Waterloo"}& {"populated place"}& {45.3500799999999984}& {-72.5158200000000051}& {"Canada"}& {"Quebec"}& {"Monteregie"}& {4064}& {"America/Toronto"}\\ {"Waterloo"}& {"populated place"}& {43.4667999999999992}& {-80.5163900000000012}& {"Canada"}& {"Ontario"}& {\mathrm{undefined}}& {97475}& {"America/Toronto"}\end{array}\right]$ (13)

To return specific data, such as the Population:

 > $\mathrm{GetData}\left({\mathrm{Waterloo_Data}}_{\left(\right)..\left(\right),\mathrm{Population}}\right)$
 $\left[\begin{array}{c}{4064}\\ {97475}\end{array}\right]$ (14)

Compatibility

 • The DataSets[Builtin][Reference][GetName], DataSets[Builtin][Reference][GetIdentifier], DataSets[Builtin][Reference][GetDescription], DataSets[Builtin][Reference][GetElementNames], DataSets[Builtin][Reference][CountRows], DataSets[Builtin][Reference][GetHeaders] and DataSets[Builtin][Reference][GetData] commands were introduced in Maple 2015.