예제 #1
0
파일: test_wb.py 프로젝트: AkiraKane/pandas
 def test_wdi_get_countries(self):
     result = get_countries()
     self.assertTrue('Zimbabwe' in list(result['name']))
     self.assertTrue(len(result) > 100)
예제 #2
0
파일: data.py 프로젝트: ecustzhy/test
    def get_countries(self, *args, **kwargs):
        """ Caches the `pandas.io.wb.get_countries()` results.

        :returns: The result of the query from cache or the WWW.
        """
        return wb.get_countries(*args, **kwargs)
예제 #3
0
 def test_wdi_get_countries(self):
     result = get_countries()
     self.assertTrue('Zimbabwe' in list(result['name']))
     self.assertTrue(len(result) > 100)
예제 #4
0
              'surplus' : 'GC.BAL.CASH.GD.ZS', 
              'centraldebt' :'GC.DOD.TOTL.GD.ZS',
               'gpd-currentdollars' :'NY.GDP.MKTP.CD'
               }

#engine = create_engine('mysql+mysqlconnector://root:[email protected]/worldbank')

# connect to mysql instance
cnx = db.open_database(config)

#create a database
db.create_database(cnx,"worldbank2")
cnx.database = "worldbank2"

# retrieve metadata about worldbank countries
wbcountries = wb.get_countries()
wbcountries.to_sql('countries', cnx, flavor='mysql', index=True, if_exists = 'replace')


# create a table for the indicators metadata.  the to_sql method truncates data 
# the column sizes are too small
tabledef = "  (  `index` bigint(20) DEFAULT NULL, \
  `id` varchar(63) DEFAULT NULL, \
  `name` varchar(500) DEFAULT NULL, \
  `source` varchar(500) DEFAULT NULL, \
  `sourceNote` varchar(4000) DEFAULT NULL, \
  `sourceOrganization` varchar(2000) DEFAULT NULL, \
  `topics` varchar(2000) DEFAULT NULL, \
  KEY `ix_indicatorsMeta_index` (`index`) )"
db.create_table(cnx, "indicatorsMeta", tabledef)