城市联系强度表数据查看分析,结合了美国县(属性表数据导出–表转Excel)的数据进行匹配分析。
import pandas as pd
df = pd.read_excel('OD_dataa_new.xls')
# 查看前5行数据
df.head()
OBJECTID | city_OD | city_a | city_b | intersect_value | |
---|---|---|---|---|---|
0 | 1 | New York-Los Angeles | New York | Los Angeles | 6665 |
1 | 2 | New York-Chicago | New York | Chicago | 6725 |
2 | 3 | New York-Houston | New York | Houston | 1155 |
3 | 4 | New York-Philadelphia | New York | Philadelphia | 1695 |
4 | 5 | New York-Phoenix | New York | Phoenix | 625 |
# 获取city_a的唯一值
city_a = df['city_a'].unique()
city_a.sort()
print(city_a,len(city_a))
['Albuquerque' 'Anaheim' 'Arlington' 'Atlanta' 'Aurora' 'Austin'
'Bakersfield' 'Baltimore' 'Baton Rouge' 'Boise' 'Boston' 'Buffalo'
'Chandler' 'Charlotte' 'Chesapeake' 'Chicago' 'Chula Vista' 'Cincinnati'
'Cleveland' 'Colorado Springs' 'Columbus' 'Corpus Christi' 'Dallas'
'Denver' 'Detroit' 'Durham' 'El Paso' 'Fort Wayne' 'Fort Worth' 'Fremont'
'Fresno' 'Garland' 'Gilbert' 'Glendale' 'Greensboro' 'Henderson'
'Hialeah' 'Houston' 'Indianapolis' 'Irvine' 'Irving' 'Jacksonville'
'Jersey City' 'Kansas City' 'Laredo' 'Las Vegas' 'Lexington' 'Lincoln'
'Long Beach' 'Los Angeles' 'Louisville' 'Lubbock' 'Madison' 'Memphis'
'Mesa' 'Miami' 'Milwaukee' 'Minneapolis' 'Nashville' 'New Orleans'
'New York' 'Newark' 'Norfolk' 'North Las Vegas' 'Oakland' 'Oklahoma City'
'Omaha' 'Orlando' 'Philadelphia' 'Phoenix' 'Pittsburgh' 'Plano'
'Portland' 'Raleigh' 'Reno' 'Richmond' 'Riverside' 'Sacramento'
'Saint Paul' 'San Antonio' 'San Bernardino' 'San Diego' 'San Francisco'
'San Jose' 'Santa Ana' 'Scottsdale' 'Seattle' 'Spokane' 'St Louis'
'St Petersburg' 'Stockton' 'Tampa' 'Toledo' 'Tucson' 'Tulsa'
'Virginia Beach' 'Washington' 'Wichita' 'Winston Salem'] 99
# 获取city_a的唯一值
city_b = df['city_b'].unique()
city_b.sort()
print(b,len(city_b))
['Lake of the Woods', 'Ferry', 'Stevens', 'Okanogan', 'Pend Oreille', 'Boundary', 'Lincoln', 'Flathead', 'Glacier', 'Toole', 'Liberty', 'Hill', 'Sheridan', 'Divide', 'Burke', 'Renville', 'Bottineau', 'Rolette', 'Towner', 'Cavalier', 'Pembina', 'Kittson', 'Roseau', 'Blaine', 'Phillips', 'Valley', 'Daniels', 'Whatcom', 'Bonner', 'Ward', 'Koochiching', 'Skagit', 'Williams', 'McHenry', 'St. Louis', 'San Juan', 'Roosevelt', 'Mountrial', 'Marshall', 'Ramsey', 'Walsh', 'Beltrami', 'Pierce', 'Chelan', 'Pondera', 'Clallam', 'Benson', 'Chouteau', 'Snohomish', 'Island', 'Sanders', 'Lake', 'Nelson', 'Grand Forks', 'Polk', 'Pennington', 'Douglas', 'McKenzie', 'Jefferson', 'Richland', 'Teton', 'McCone', 'Shoshone', 'Spokane', 'Clearwater', 'Kootenai', 'Garfield', 'Red Lake', 'Grant', 'Lewis and Clark', 'Kitsap', 'Itasca', 'Wells', 'McLean', 'Eddy', 'Dunn', 'Fergus', 'Dawson', 'King', 'Cascade', 'Griggs', 'Steele', 'Traill', 'Mason', 'Missoula', 'Petroleum', 'Powell', 'Kittitas', 'Foster', 'Mercer', 'Grays Harbor', 'Norman', 'Mahnomen', 'Mineral', 'Cass', 'Aroostook', 'Judith Basin', 'Hubbard', 'Benewah', 'Wibaux', 'Golden Valley', 'Billings', 'Stutsman', 'Kidder', 'Burleigh', 'Oliver', 'Adams', 'Whitman', 'Barnes', 'Prairie', 'Becker', 'Clay', 'Thurston', 'Latah', 'Meagher', 'Yakima', 'Aitkin', 'Stark', 'Morton', 'Bayfield', 'Custer', 'Rosebud', 'Granite', 'Wadena', 'Crow Wing', 'Pacific', 'Lewis', 'Broadwater', 'Carlton', 'Musselshell', 'Wheatland', 'Franklin', 'Benton', 'Otter Tail', 'Fallon', 'Idaho', 'Ravalli', 'Ashland', 'Logan', 'Emmons', 'La Moure', 'Slope', 'Hettinger', 'Ransom', 'Wilkin', 'Nez Perce', 'Columbia', 'Walla Walla', 'Iron', 'Somerset', 'Piscataquis', 'Yellowstone', 'Treasure', 'Asotin', 'Sioux', 'Pine', 'Penobscot', 'Skamania', 'Cowlitz', 'Wahkiakum', 'Todd', 'Morrison', 'McIntosh', 'Dickey', 'Sargent', 'Bowman', 'Deer Lodge', 'Mille Lacs', 'Clatsop', 'Sweet Grass', 'Gallatin', 'Park', 'Silver Bow', 'Washburn', 'Sawyer', 'Burnett', 'Kanabec', 'Carter', 'Stillwater', 'Clark', 'Klickitat', 'Big Horn', 'Traverse', 'Umatilla', 'Wallowa', 'Price', 'Campbell', 'Harding', 'McPherson', 'Perkins', 'Corson', 'Brown', 'Beaverhead', 'Roberts', 'Morrow', 'Union', 'Madison', 'Gilliam', 'Powder River', 'Stearns', 'Tillamook', 'Washington', 'Pope', 'Isanti', 'Chisago', 'Sherman', 'Multnomah', 'Hood River', 'Wasco', 'Lemhi', 'Barron', 'Rusk', 'Carbon', 'Walworth', 'Edmunds', 'Day', 'Big Stone', 'Sherburne', 'Ziebach', 'Dewey', 'Clackamas', 'Wright', 'Yamhill', 'Anoka', 'Kandiyohi', 'Swift', 'Taylor', 'Oxford', 'Meeker', 'Coos', 'Chippewa', 'Marion', 'Lac Qui Parle', 'Potter', 'Faulk', 'Hennepin', 'Spink', 'St. Croix', 'Butte', 'Codington', 'Yellowstone National Park (Part)', 'Baker', 'Wheeler', 'Meade', 'Essex', 'Grand Isle', 'Orleans', 'Clinton', 'Crook', 'McLeod', 'Carver', 'Deuel', 'Dakota', 'Yellow Medicine', 'Sully', 'Hyde', 'Hand', 'Eau Claire', 'Scott', 'Hamlin', 'Lamoille', 'Linn', 'Stanley', 'Caledonia', 'Waldo', 'Haakon', 'Fremont', 'Sibley', 'Chittenden', 'Kennebec', 'Goodhue', 'Redwood', 'Wood', 'Pepin', 'Beadle', 'Lyon', 'Lawrence', 'Buffalo', 'Trempealeau', 'Jackson', 'Johnson', 'Hughes', 'Le Sueur', 'Rice', 'Kingsbury', 'Brookings', 'Gem', 'Androscoggin', 'Nicollet', 'Wabasha', 'Malheur', 'Hancock', 'Grafton', 'Deschutes', 'Knox', 'Boise', 'Addison', 'Carroll', 'Lane', 'Blue Earth', 'Juneau', 'Lyman', 'Orange', 'Waseca', 'Jerauld', 'Moody', 'Pipestone', 'Dodge', 'Sanborn', 'Murray', 'Cottonwood', 'Olmsted', 'Miner', 'Winona', 'Weston', 'Jones', 'Cumberland', 'Washakie', 'Monroe', 'Payette', 'Hamilton', 'Watonwan', 'Herkimer', 'La Crosse', 'Elmore', 'Hot Springs', 'Harney', 'Sagadahoc', 'Windsor', 'Aurora', 'Brule', 'Canyon', 'Mellette', 'Camas', 'Rutland', 'Faribault', 'Minnehaha', 'Rock', 'Freeborn', 'Nobles', 'Martin', 'Houston', 'Mower', 'Fillmore', 'Davison', 'Hanson', 'McCook', 'York', 'Ada', 'Warren', 'Tripp', 'Belknap', 'Vernon', 'Shannon', 'Owyhee', 'Bonneville', 'Bingham', 'Klamath', 'Merrimack', 'Sullivan', 'Strafford', 'Natrona', 'Gregory', 'Niobrara', 'Charles Mix', 'Turner', 'Worth', 'Mitchell', 'Allamakee', 'Winnebago', 'Winneshiek', 'Converse', 'Osceola', 'Dickinson', 'Kossuth', 'Howard', 'Emmet', 'Hutchinson', 'Fall River', 'Sublette', 'Crawford', 'Saratoga', 'Bennett', 'Bennington', 'Fulton', 'Rockingham', 'Windham', "O'Brien", 'Cerro Gordo', 'Palo Alto', 'Floyd', 'Chickasaw', 'Iowa', 'Hillsborough', 'Gooding', 'Minidoka', 'Cheshire', 'Yankton', 'Bon Homme', 'Power', 'Fayette', 'Clayton', 'Montgomery', 'Caribou', 'Bannock', 'Dawes', 'Keya Paha', 'Boyd', 'Cherry', 'Curry', 'Rensselaer', 'Schenectady', 'Plymouth', 'Cherokee', 'Bremer', 'Butler', 'Buena Vista', 'Twin Falls', 'Pocahontas', 'Humboldt', 'Otsego', 'Holt', 'Cedar', 'Jerome', 'Schoharie', 'Lafayette', 'Albany', 'Josephine', 'Dixon', 'Berkshire', 'Middlesex', 'Worcester', 'Dubuque', 'Cassia', 'Webster', 'Delaware', 'Buchanan', 'Black Hawk', 'Goshen', 'Platte', 'Bear Lake', 'Woodbury', 'Ida', 'Sac', 'Calhoun', 'Hampshire', 'Hardin', 'Grundy', 'Jo Daviess', 'Oneida', 'Greene', 'Suffolk', 'Box Butte', 'Antelope', 'Wayne', 'Hampden', 'Tama', 'Sweetwater', 'Norfolk', 'Monona', 'Boone', 'Story', 'Ulster', 'Cuming', 'Bristol', 'Stanton', 'Loup', 'Hooker', 'Thomas', 'Dutchess', 'Barnstable', 'Burt', 'Litchfield', 'Hartford', 'Tolland', 'Providence', 'Cache', 'Siskiyou', 'Garden', 'Box Elder', 'Rich', 'Scotts Bluff', 'Morrill', 'Del Norte', 'Elko', 'Modoc', 'Washoe', 'Jasper', 'Poweshiek', 'Harrison', 'Guthrie', 'Shelby', 'Audubon', 'Dallas', 'Rock Island', 'Kent', 'Colfax', 'Arthur', 'Greeley', 'Will', 'Lucas', 'Kendall', 'Porter', 'Geauga', 'New London', 'Banner', 'Newport', 'Fairfield', 'Laramie', 'Wyoming', 'New Haven', 'Lackawanna', 'La Salle', 'Elk', 'Cuyahoga', 'Venango', 'Forest', 'Ottawa', 'Cameron', 'Pike', 'Lycoming', 'Muscatine', 'Bureau', 'Henry', 'Uinta', 'Noble', 'De Kalb', 'Putnam', 'Nance', 'Lorain', 'Mahaska', 'Pottawattamie', 'Keokuk', 'Adair', 'Sandusky', 'Trumbull', 'Dukes', 'Saunders', 'Erie', 'Kosciusko', 'Starke', 'Clarion', 'Cheyenne', 'Defiance', 'Weber', 'Louisa', 'Luzerne', 'Merrick', 'Nantucket', 'Keith', 'Kimball', 'Morgan', 'Trinity', 'Westchester', 'Sussex', 'Summit', 'Portage', 'Rockland', 'Kankakee', 'Whitley', 'Huron', 'Allen', 'Medina', 'Centre', 'Clearfield', 'Seneca', 'Paulding', 'Newton', 'Passaic', 'Sarpy', 'Shasta', 'Lassen', 'Northumberland', 'Armstrong', 'Pulaski', 'Montour', 'Mills', 'Clarke', 'Wapello', 'Davis', 'Mahoning', 'Bergen', 'Livingston', 'Tooele', 'Morris', 'Des Moines', 'Henderson', 'Wabash', 'Seward', 'Lancaster', 'Hall', 'Huntington', 'Iroquois', 'Miami', 'Ford', 'Moffat', 'Weld', 'Sedgwick', 'Routt', 'Larimer', 'Daggett', 'Lander', 'Eureka', 'Van Wert', 'Wyandot', 'Peoria', 'Northampton', 'Pershing', 'Schuylkill', 'Woodford', 'Columbiana', 'Bronx', 'White', 'Salt Lake', 'Indiana', 'Page', 'Ringgold', 'Nassau', 'Van Buren', 'Decatur', 'Appanoose', 'Snyder', 'New York', 'Uintah', 'Beaver', 'Mifflin', 'Duchesne', 'Hudson', 'Lee', 'Queens', 'Otoe', 'Lehigh', 'Hunterdon', 'Tazewell', 'Blair', 'Huntingdon', 'Kings', 'Cambria', 'Saline', 'Juniata', 'Hayes', 'Chase', 'Frontier', 'Gosper', 'Auglaize', 'Kearney', 'Wasatch', 'Phelps', 'Berks', 'Westmoreland', 'Allegheny', 'Holmes', 'Dauphin', 'Tuscarawas', 'Richmond', 'McDonough', 'Perry', 'Bucks', 'Scotland', 'Schuyler', 'Blackford', 'Atchison', 'Jay', 'Utah', 'Nodaway', 'Tippecanoe', 'Nemaha', 'Lebanon', 'Gage', 'Vermilion', 'Grand', 'Coshocton', 'Tehama', 'Monmouth', 'Plumas', 'Yuma', 'Tipton', 'Champaign', 'Brooke', 'Gentry', 'Fountain', 'Darke', 'Thayer', 'Dundy', 'Nuckolls', 'Hitchcock', 'Harlan', 'Furnas', 'Red Willow', 'Bedford', 'Randolph', 'Piatt', 'De Witt', 'Licking', 'Richardson', 'Pawnee', 'Boulder', 'Chester', 'Rio Blanco', 'Guernsey', 'Ohio', 'Burlington', 'Vermillion', 'Menard', 'Belmont', 'Ocean', 'Muskingum', 'Daviess', 'Philadelphia', 'Andrew', 'White Pine', 'Macon', 'Juab', 'Churchill', 'Norton', 'Rawlins', 'Republic', 'Doniphan', 'Mendocino', 'Smith', 'Jewell', 'Camden', 'Sangamon', 'Parke', 'Hendricks', 'Gilpin', 'Preble', 'Eagle', 'Edgar', 'Gloucester', 'Clear Creek', 'New Castle', 'Christian', 'Sanpete', 'Pickaway', 'Denver', 'Glenn', 'Moultrie', 'Rush', 'Caldwell', 'Salem', 'Sierra', 'Arapahoe', 'Atlantic', 'Allegany', 'Cecil', 'Garrett', 'Harford', 'Monongalia', 'Preston', 'Baltimore', 'Wetzel', 'Frederick', 'Chariton', 'Emery', 'Coles', 'Ralls', 'Hocking', 'Cloud', 'Yuba', 'Storey', 'Berkeley', 'Vigo', 'Tyler', 'Kit Carson', 'Elbert', 'Riley', 'Rooks', 'Osborne', 'Pottawatomie', 'Graham', 'Athens', 'Millard', 'Macoupin', 'Ray', 'Nevada', 'Ross', 'Pleasants', 'Owen', 'Doddridge', 'Colusa', 'Leavenworth', 'Ritchie', 'Vinton', 'Highland', 'Baltimore City', 'Mesa', 'Pitkin', 'Audrain', 'Bartholomew', 'Cape May', 'Loudoun', 'Dearborn', 'Placer', 'Ripley', 'Sutter', 'Barbour', 'Queen Annes', 'Tucker', 'Clermont', 'Carson City', 'Jersey', 'Gunnison', 'Hardy', 'Anne Arundel', 'Geary', 'Shawnee', 'Effingham', 'Delta', 'Wabaunsee', 'Winchester', 'Meigs', 'Wyandotte', 'Jennings', 'Wirt', 'Nye', 'Caroline', 'Trego', 'Ellis', 'Gove', 'Prince Georges', 'Wallace', 'Russell', 'El Paso', 'Teller', 'Upshur', 'Gilmer', 'Shenandoah', 'Kenton', 'Callaway', 'El Dorado', 'Fairfax', 'Cooper', 'Chaffee', 'Sevier', 'Gallia', 'Bond', 'Scioto', 'Fauquier', 'St. Charles', 'Pendleton', 'Talbot', 'Roane', 'Pettis', 'Prince William', 'Arlington', 'Switzerland', 'Yolo', 'Alpine', 'Moniteau', 'Braxton', 'Falls Chruch', 'Fairfax City', 'Osage', 'Ellsworth', 'Rappahannock', 'Napa', 'Sonoma', 'Alexandria', 'Bracken', 'St. Louis City', 'Manassas Park City', 'Manassas City', 'Calvert', 'Greenup', 'Trimble', 'Sacramento', 'Cole', 'Gasconade', 'Charles', 'Mono', 'Dorchester', 'Culpeper', 'Amador', 'Wichita', 'Ness', 'Barton', 'Montrose', 'St. Clair', 'Kanawha', 'Kiowa', 'Robertson', 'Stafford', 'Cabell', 'Edwards', 'Nicholas', 'Wicomico', 'Oldham', 'Fleming', 'Gibson', 'Dubois', 'Pueblo', 'Crowley', 'St. Marys', 'Piute', 'Calaveras', 'Augusta', 'Bates', 'Harrisonburg', 'Saguache', 'Esmeralda', 'Tuolumne', 'Coffey', 'Miller', 'Rowan', 'Anderson', 'Spotsylvania', 'King George', 'Bourbon', 'Ouray', 'Marin', 'Fredericksburg', 'Bath', 'San Joaquin', 'Maries', 'Albemarle', 'Elliott', 'Greenbrier', 'Prowers', 'Bent', 'Kearny', 'Otero', 'Finney', 'Hodgeman', 'Warrick', 'Posey', 'Spencer', 'Staunton', 'Vanderburgh', 'Harvey', 'Reno', 'Greenwood', 'Solano', 'San Miguel', 'Hinsdale', 'Ste. Genevieve', 'Bullitt', 'Contra Costa', 'Waynesboro', 'Rockbridge', 'St. Francois', 'Stanislaus', 'Hickory', 'Charlottesville', 'Menifee', 'Breckinridge', 'Woodson', 'Accomack', 'Hanover', 'Fluvanna', 'Huerfano', 'Jessamine', 'Gray', 'Raleigh', 'Mingo', 'King and Queen', 'Alleghany', 'King William', 'Goochland', 'Dolores', 'Alameda', 'Mariposa', 'Magoffin', 'Laclede', 'Williamson', 'Summers', 'Wolfe', 'Clifton Forge', 'Estill', 'Rio Grande', 'Garrard', 'Pratt', 'Amherst', 'San Francisco', 'Covington', 'Las Animas', 'Lexington', 'Botetourt', 'Buckingham', 'Dent', 'Madera', 'Alamosa', 'Haskell', 'Larue', 'Wilson', 'Neosho', 'Kingman', 'Boyle', 'Henrico', 'San Mateo', 'Breathitt', 'Powhatan', 'Craig', 'Baca', 'Costilla', 'Montezuma', 'La Plata', 'New Kent', 'Merced', 'Grayson', 'Richmond City', 'Texas', 'Reynolds', 'Bollinger', 'Cape Girardeau', 'Dade', 'Fresno', 'Hopkins', 'Chesterfield', 'Appomattox', 'Casey', 'McDowell', 'Crittenden', 'Kane', 'Owsley', 'Rockcastle', 'Knott', 'Mathews', 'Amelia', 'Charles City', 'Santa Clara', 'Giles', 'Sumner', 'Cowley', 'Lynchburg', 'Green', 'Barber', 'James City', 'Inyo', 'Hart', 'Archuleta', 'Muhlenberg', 'Roanoke', 'Prince Edward', 'Conejos', 'Harper', 'Labette', 'Comanche', 'Bedford City', 'Massac', 'Alexander', 'Edmonson', 'Laurel', 'Prince George', 'Roanoke City', 'Hopewell', 'Leslie', 'Bland', 'Dickenson', 'Chautauqua', 'Nottoway', 'Colonial Heights', 'Williamsburg', 'Santa Cruz', 'Dinwiddie', 'Letcher', 'Charlotte', 'Surry', 'Petersburg', 'Newport News', 'Ballard', 'McCracken', 'Wise', 'Metcalfe', 'Poquoson City', 'Barren', 'Radford', 'Isle of Wight', 'Pittsylvania', 'Stoddard', 'Lunenburg', 'Hampton', 'Mississippi', 'Wythe', 'Howell', 'Halifax', 'Brunswick', 'Smyth', 'Trigg', 'Navajo', 'Coconino', 'Nowata', 'Kay', 'Rio Arriba', 'Alfalfa', 'Cimarron', 'Woods', 'Mohave', 'Southampton', 'Apache', 'Taos', 'Stone', 'San Benito', 'Carlisle', 'McCreary', 'Bell', 'Graves', 'Virginia Beach', 'Barry', 'Monterey', 'Greensville', 'Mecklenburg', 'Simpson', 'Oregon', 'Patrick', 'New Madrid', 'Chesapeake', 'Portsmouth', 'Taney', 'Woodward', 'Ozark', 'Hickman', 'McDonald', 'Calloway', 'Tulare', 'Emporia', 'Martinsville', 'South Boston', 'Galax', 'Franklin City', 'Stewart', 'Danville', 'Dunklin', 'Pickett', 'Rogers', 'Claiborne', 'Hawkins', 'Ashe', 'Fentress', 'Currituck', 'Hertford', 'Gates', 'Stokes', 'Caswell', 'Granville', 'Person', 'Vance', 'Overton', 'Mayes', 'Major', 'Pasquotank', 'Obion', 'Weakley', 'Trousdale', 'Lipscomb', 'Dallam', 'Hansford', 'Baxter', 'Sharp', 'Ochiltree', 'Cheatham', 'Tulsa', 'Wilkes', 'Pemiscot', 'Grainger', 'Davidson', 'Watauga', 'Perquimans', 'Hamblen', 'Chowan', 'Dickson', 'Avery', 'Yadkin', 'Mora', 'Izard', 'Unicoi', 'Forsyth', 'Payne', 'Humphreys', 'Guilford', 'Alamance', 'Bertie', 'Durham', 'Sandoval', 'Dyer', 'Nash', 'Cocke', 'Creek', 'Kingfisher', 'Wagoner', 'Edgecombe', 'Searcy', 'Rutherford', 'Yancey', 'Wake', 'Hemphill', 'Hartley', 'Moore', 'Iredell', 'Davie', 'Roger Mills', 'Santa Fe', 'McKinley', 'Crockett', 'Craighead', 'Los Alamos', 'Cannon', 'Tyrrell', 'Lauderdale', 'Independence', 'Loudon', 'Blount', 'Chatham', 'Muskogee', 'Okmulgee', 'Maury', 'Rhea', 'Pitt', 'Catawba', 'Haywood', 'Buncombe', 'Johnston', 'Kern', 'San Bernardino', 'San Luis Obispo', 'Bledsoe', 'Dare', 'Quay', 'Beaufort', 'Canadian', 'Oklahoma', 'Cleburne', 'Coffee', 'Poinsett', 'Swain', 'McMinn', 'Okfuskee', 'Sequoyah', 'Carson', 'Harnett', 'Sequatchie', 'Cleveland', 'Caddo', 'Yavapai', 'Cabarrus', 'Beckham', 'Stanly', 'Washita', 'Conway', 'Seminole', 'Sebastian', 'Cross', 'Woodruff', 'Hardeman', 'Lenoir', 'Transylvania', 'Gaston', 'Le Flore', 'McNairy', 'Grady', 'Faulkner', 'Bradley', 'Cibola', 'McClain', 'Sampson', 'Pittsburg', 'Pamlico', 'Yell', 'Bernalillo', 'Guadalupe', 'Greenville', 'Anson', 'Hoke', 'Spartanburg', 'Duplin', 'Randall', 'Collingsworth', 'Donley', 'Deaf Smith', 'St. Francis', 'Greer', 'Pickens', 'Lonoke', 'Latimer', 'Craven', 'Oconee', 'Torrance', 'Harmon', 'Limestone', 'Alcorn', 'Tishomingo', 'Tippah', 'De Soto', 'Rabun', 'Whitfield', 'Catoosa', 'Walker', 'Towns', 'Fannin', 'Onslow', 'Pontotoc', 'Valencia', 'Robeson', 'Colbert', 'Ventura', 'Tunica', 'Carteret', 'Garvin', 'Bladen', 'Habersham', 'Marlboro', 'Tate', 'Laurens', 'Garland', 'De Baca', 'Coal', 'Prentiss', 'Parmer', 'Castro', 'Swisher', 'Briscoe', 'Childress', 'Pender', 'Lumpkin', 'Pushmataha', 'Atoka', 'Stephens', 'Tillman', 'Gordon', 'Dillon', 'Kershaw', 'Catron', 'Chattooga', 'Socorro', 'Arkansas', 'Panola', 'Coahoma', 'Darlington', 'Newberry', 'Gila', 'Quitman', 'Hot Spring', 'McCurtain', 'Cotton', 'Banks', 'Abbeville', 'Columbus', 'Itawamba', 'Wilbarger', 'Bartow', 'New Hanover', 'La Paz', 'Motley', 'Cullman', 'Cottle', 'Winston', 'Hale', 'Lamb', 'Bailey', 'Florence', 'Horry', 'Foard', 'Etowah', 'Yalobusha', 'Saluda', 'Gwinnett', 'Tallahatchie', 'Bryan', 'Choctaw', 'Sumter', 'Barrow', 'Desha', 'Bolivar', 'Cobb', 'Chaves', 'Riverside', 'McCormick', 'Love', 'Lamar', 'Oglethorpe', 'Maricopa', 'Santa Barbara', 'Hempstead', 'Sunflower', 'Montague', 'Edgefield', 'Red River', 'Cooke', 'Little River', 'Clarendon', 'Walton', 'Haralson', 'Grenada', 'Aiken', 'Dickens', 'Crosby', 'Lubbock', 'Archer', 'Hockley', 'Baylor', 'Cochran', 'Ouachita', 'Leflore', 'Drew', 'Rockdale', 'Greenlee', 'Georgetown', 'Lowndes', 'Taliaferro', 'Orangeburg', 'Bowie', 'Talladega', 'McDuffie', 'Tuscaloosa', 'Oktibbeha', 'Lea', 'Chicot', 'Coweta', 'San Diego', 'Barnwell', 'Los Angeles', 'Pinal', 'Jack', 'Butts', 'Imperial', 'Denton', 'Bamberg', 'Heard', 'Hunt', 'Collin', 'Ashley', 'Titus', 'Throckmorton', 'Young', 'Stonewall', 'Garza', 'Lynn', 'Terry', 'Yoakum', 'Spalding', 'Glascock', 'Attala', 'Noxubee', 'Bibb', 'Meriwether', 'Troup', 'Baldwin', 'Colleton', 'Allendale', 'Chambers', 'Tallapoosa', 'Coosa', 'Sharkey', 'Camp', 'Chilton', 'Dona Ana', 'Screven', 'Yazoo', 'Charleston', 'Bossier', 'Issaquena', 'Morehouse', 'West Carroll', 'East Carroll', 'Wilkinson', 'Palo Pinto', 'Upson', 'Parker', 'Tarrant', 'Rockwall', 'Rains', 'Shackelford', 'Fisher', 'Scurry', 'Borden', 'Gaines', 'Jenkins', 'Neshoba', 'Leake', 'Kemper', 'Twiggs', 'Harris', 'Kaufman', 'Van Zandt', 'Emanuel', 'Hidalgo', 'Autauga', 'Peach', 'Gregg', 'Bulloch', 'Luna', 'Muscogee', 'Rankin', 'Bienville', 'Bleckley', 'Hinds', 'Hood', 'Candler', 'Marengo', 'Chattahoochee', 'Pima', 'Eastland', 'Callahan', 'Andrews', 'Nolan', 'Erath', 'Treutlen', 'Cochise', 'Schley', 'Toombs', 'Navarro', 'Somervell', 'Bullock', 'Tattnall', 'Dooly', 'Wilcox', 'Evans', 'Tensas', 'Bosque', 'Winn', 'Natchitoches', 'Telfair', 'Sterling', 'Glasscock', 'Midland', 'Coke', 'Winkler', 'Ector', 'Runnels', 'Coleman', 'Crenshaw', 'Copiah', 'Crisp', 'Freestone', 'Long', 'Culberson', 'Reeves', 'Loving', 'Hudspeth', 'Catahoula', 'Jeff Davis', 'Appling', 'Terrell', 'McLennan', 'Nacogdoches', 'Sabine', 'Ben Hill', 'Jefferson Davis', 'Irwin', 'Concordia', 'Conecuh', 'Coryell', 'Bacon', 'Tom Green', 'Dougherty', 'San Augustine', 'Crane', 'Upton', 'Reagan', 'Leon', 'Dale', 'Tift', 'Concho', 'Irion', 'Angelina', 'Falls', 'Early', 'Rapides', 'McCulloch', 'San Saba', 'Berrien', 'Ware', 'Lampasas', 'Glynn', 'Forrest', 'Atkinson', 'Pecos', 'Brantley', 'Amite', 'Walthall', 'Cook', 'Avoyelles', 'Colquitt', 'Escambia', 'Geneva', 'Lanier', 'Clinch', 'Mobile', 'Milam', 'Schleicher', 'Brooks', 'Charlton', 'Burnet', 'Pointe Coupee', 'Pearl River', 'Tangipahoa', 'St. Helena', 'East Feliciana', 'George', 'West Feliciana', 'Evangeline', 'Brazos', 'Llano', 'San Jacinto', 'Beauregard', 'Grimes', 'Echols', 'St. Landry', 'Burleson', 'East Baton Rouge', 'Kimble', 'Gadsden', 'St. Tammany', 'Sutton', 'Brewster', 'West Baton Rouge', 'Presidio', 'Travis', 'Duval', 'Bay', 'Gillespie', 'Blanco', 'St. Martin', 'Iberville', 'Calcasieu', 'Acadia', 'Suwannee', 'Bastrop', 'Okaloosa', 'Santa Rosa', 'Ascension', 'Hays', 'St. John the Baptist', 'Wakulla', 'Val Verde', 'Kerr', 'Waller', 'St. Johns', 'Gulf', 'St. James', 'Bradford', 'Austin', 'Real', 'Assumption', 'St. Bernard', 'Comal', 'Colorado', 'St. Mary', 'Alachua', 'Gilchrist', 'LaFourche', 'Bandera', 'Plaquemines', 'Dixie', 'Fort Bend', 'Gonzales', 'Bexar', 'Flagler', 'Iberia', 'Lavaca', 'Wharton', 'Uvalde', 'Kinney', 'Brazoria', 'Levy', 'Galveston', 'Volusia', 'Terrebonne', 'Atascosa', 'Matagorda', 'Karnes', 'Victoria', 'Zavala', 'Frio', 'Maverick', 'Citrus', 'Goliad', 'Live Oak', 'Bee', 'Hernando', 'McMullen', 'Dimmit', 'Brevard', 'Refugio', 'Pasco', 'Webb', 'Pinellas', 'San Patricio', 'Aransas', 'Jim Wells', 'Indian River', 'Nueces', 'Hardee', 'Highlands', 'Manatee', 'Okeechobee', 'Kleberg', 'St. Lucie', 'Sarasota', 'Jim Hogg', 'Zapata', 'Glades', 'Kenedy', 'Palm Beach', 'Hendry', 'Starr', 'Willacy', 'Collier', 'Broward', 'Keweenaw', 'Houghton', 'Ontonagon', 'Baraga', 'Marquette', 'Gogebic', 'Luce', 'Alger', 'Schoolcraft', 'Vilas', 'Mackinac', 'Menominee', 'Marinette', 'Cheboygan', 'Presque Isle', 'Langlade', 'Oconto', 'Charlevoix', 'Door', 'Alpena', 'Antrim', 'Montmorency', 'Leelanau', 'Marathon', 'Shawano', 'St. Lawrence', 'Kalkaska', 'Alcona', 'Grand Traverse', 'Oscoda', 'Benzie', 'Kewaunee', 'Waupaca', 'Outagamie', 'Manistee', 'Iosco', 'Wexford', 'Missaukee', 'Roscommon', 'Ogemaw', 'Manitowoc', 'Waushara', 'Calumet', 'Arenac', 'Clare', 'Gladwin', 'Green Lake', 'Fond Du Lac', 'Sheboygan', 'Oceana', 'Isabella', 'Newaygo', 'Mecosta', 'Tuscola', 'Oswego', 'Sanilac', 'Sauk', 'Saginaw', 'Ozaukee', 'Muskegon', 'Montcalm', 'Gratiot', 'Cayuga', 'Niagara', 'Lapeer', 'Dane', 'Onondaga', 'Genesee', 'Waukesha', 'Milwaukee', 'Shiawassee', 'Ionia', 'Ontario', 'Macomb', 'Oakland', 'Racine', 'Cortland', 'Ingham', 'Allegan', 'Eaton', 'Yates', 'Chenango', 'Kenosha', 'Tompkins', 'Steuben', 'Cattaraugus', 'Stephenson', 'Washtenaw', 'Kalamazoo', 'Broome', 'Tioga', 'Chemung', 'Ogle', 'Lenawee', 'Hillsdale', 'Branch', 'St. Joseph', 'Susquehanna', 'McKean', 'Du Page', 'Ashtabula', 'Whiteside', 'La Porte', 'Elkhart', 'Lagrange', 'North Slope', 'Northwest Arctic', 'Fairbanks North Star', 'Bristol Bay', 'Yukon-Koyukuk', 'Southeast Fairbanks', 'Nome', 'Matanuska-Susitna', 'Wade Hampton', 'Bethel', 'Anchorage', 'Kenai Peninsula', 'Dillingham', 'Lake and Peninsula', 'Valdez-Cordova', 'Haines', 'Kodiak Island', 'Skagway-Yakutat-Angoon', 'Sitka', 'Wrangell-Petersburg', 'Ketchikan Gateway', 'Prince of Wales-Outer Ketchikan', 'Aleutians East', 'Aleutians West', 'Kalawao', 'Kauai', 'Honolulu', 'Maui', 'Hawaii'] 99
import pandas as pd
dfx = pd.read_excel('美国县.xls')
# 查看前5行数据
dfx.head()
OBJECTID_1 | OBJECTID | NAME | STATE_NAME | STATE_FIPS | CNTY_FIPS | FIPS | AREA | POP1990 | POP2000 | POP90_SQMI | Shape_Leng | Shape_Length | Shape_Area | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | Lake of the Woods | Minnesota | 27 | 77 | 27077 | 1784.0634 | 4076 | 4651 | 2 | 375147.267550 | 375147.267353 | 4.620986e+09 |
1 | 2 | 2 | Ferry | Washington | 53 | 19 | 53019 | 2280.2319 | 6295 | 7199 | 3 | 372231.202858 | 372231.202772 | 5.905464e+09 |
2 | 3 | 3 | Stevens | Washington | 53 | 65 | 53065 | 2529.9794 | 30948 | 40652 | 12 | 462471.138865 | 462471.138943 | 6.552176e+09 |
3 | 4 | 4 | Okanogan | Washington | 53 | 47 | 53047 | 5306.1800 | 33350 | 38640 | 6 | 581636.386735 | 581636.386959 | 1.373762e+10 |
4 | 5 | 5 | Pend Oreille | Washington | 53 | 51 | 53051 | 1445.0286 | 8915 | 11752 | 6 | 307729.184493 | 307729.184524 | 3.742470e+09 |
# 提取美国县的所有名称
c = dfx['NAME'].unique()
c = c.tolist()
c.sort()
print(c[:100],len(c))
['Abbeville', 'Acadia', 'Accomack', 'Ada', 'Adair', 'Adams', 'Addison', 'Aiken', 'Aitkin', 'Alachua', 'Alamance', 'Alameda', 'Alamosa', 'Albany', 'Albemarle', 'Alcona', 'Alcorn', 'Aleutians East', 'Aleutians West', 'Alexander', 'Alexandria', 'Alfalfa', 'Alger', 'Allamakee', 'Allegan', 'Allegany', 'Alleghany', 'Allegheny', 'Allen', 'Allendale', 'Alpena', 'Alpine', 'Amador', 'Amelia', 'Amherst', 'Amite', 'Anchorage', 'Anderson', 'Andrew', 'Andrews', 'Androscoggin', 'Angelina', 'Anne Arundel', 'Anoka', 'Anson', 'Antelope', 'Antrim', 'Apache', 'Appanoose', 'Appling', 'Appomattox', 'Aransas', 'Arapahoe', 'Archer', 'Archuleta', 'Arenac', 'Arkansas', 'Arlington', 'Armstrong', 'Aroostook', 'Arthur', 'Ascension', 'Ashe', 'Ashland', 'Ashley', 'Ashtabula', 'Asotin', 'Assumption', 'Atascosa', 'Atchison', 'Athens', 'Atkinson', 'Atlantic', 'Atoka', 'Attala', 'Audrain', 'Audubon', 'Auglaize', 'Augusta', 'Aurora', 'Austin', 'Autauga', 'Avery', 'Avoyelles', 'Baca', 'Bacon', 'Bailey', 'Baker', 'Baldwin', 'Ballard', 'Baltimore', 'Baltimore City', 'Bamberg', 'Bandera', 'Banks', 'Banner', 'Bannock', 'Baraga', 'Barber', 'Barbour'] 1833
# 提取美国州的所有名称
d = dfx['STATE_NAME'].unique()
d = d.tolist()
d.sort()
print(d,len(d))
['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'] 51
count = 0
p_name = []
for i in city_a:
if i in c:
p_name.append(i)
count += 1
print('一共匹配%d个县'%count)
print('匹配的县名为:',p_name)
一共匹配44个县
匹配的县名为: ['Arlington', 'Aurora', 'Austin', 'Baltimore', 'Boise', 'Buffalo', 'Charlotte', 'Chesapeake', 'Cleveland', 'Columbus', 'Dallas', 'Denver', 'Durham', 'El Paso', 'Fremont', 'Fresno', 'Garland', 'Henderson', 'Houston', 'Lexington', 'Lincoln', 'Los Angeles', 'Lubbock', 'Madison', 'Mesa', 'Miami', 'Milwaukee', 'New York', 'Norfolk', 'Oakland', 'Philadelphia', 'Raleigh', 'Reno', 'Richmond', 'Riverside', 'Sacramento', 'San Bernardino', 'San Diego', 'San Francisco', 'Spokane', 'Tulsa', 'Virginia Beach', 'Washington', 'Wichita']
count = 0
p_name = []
for i in city_a:
if i in d:
p_name.append(i)
count += 1
print('一共匹配%d个州'%count)
print('匹配的州名为:',p_name)
一共匹配2个州
匹配的州名为: ['New York', 'Washington']
count = 0
p_name = []
for i in city_b:
if i in c:
p_name.append(i)
count += 1
print('一共匹配%d个县'%count)
print('匹配的县名为:',p_name)
一共匹配43个县
匹配的县名为: ['Arlington', 'Aurora', 'Austin', 'Baltimore', 'Boise', 'Buffalo', 'Charlotte', 'Chesapeake', 'Cleveland', 'Columbus', 'Dallas', 'Denver', 'Durham', 'El Paso', 'Fremont', 'Fresno', 'Garland', 'Henderson', 'Houston', 'Lexington', 'Lincoln', 'Los Angeles', 'Lubbock', 'Madison', 'Mesa', 'Miami', 'Milwaukee', 'Norfolk', 'Oakland', 'Philadelphia', 'Raleigh', 'Reno', 'Richmond', 'Riverside', 'Sacramento', 'San Bernardino', 'San Diego', 'San Francisco', 'Spokane', 'Tulsa', 'Virginia Beach', 'Washington', 'Wichita']
count = 0
p_name = []
for i in city_b:
if i in d:
p_name.append(i)
count += 1
print('一共匹配%d个州'%count)
print('匹配的州名为:',p_name)
一共匹配1个州
匹配的州名为: ['Washington']
在次将此次删除字段的结果导出,因为需要对city_a与city_b匹配坐标,因此需要连接两次,所以就再次导出数据。然后再将这两次导出的结果,结果1删除X2、Y2字段,结果1删除X1、Y1字段。
【参考一】使用ArcGIS制作城市关系强度图
【参考二】迁徙图?流向图?城市关系强度图?【微信公众号:码上GIS】
【参考三】ArcGIS制作城市空间经济联系强度图