-1

I'm trying to pull data from a csv file of census API variables and the code will select all state, county, and census tracts. I am getting a "TypeError: state_county_tract()"; "takes 5 positional arguments but 6 were given." There seems to have returned a wrapper function of "(self, *args, **kwargs)."

I know I have the hierarchy in order "state_county_tract" and I am using wildcard of '(:*)' for each: stateFIPS, countyFIPS, tractFIPS.

```x = c.acs5.state_county_tract(mylist, stateFIPS, countyFIPS, tractFIPS, Census.ALL)  # mylist is a list of census variable names
```df = pd.DataFrame(x)
def main():
```df = pd.read_csv(r'C:\file.csv')
```mylist = df['Code'].values.tolist()
```tableName = 'acs2017'
```getData(mylist, tableName, 'census')
main() 

1 Answers1

0
````for s in state_fips:
````````x = c.acs5.state_county_tract(mylist, s, county_fips, tract)  # mylist is a list 
````````of census variable names
````````df = pd.DataFrame(x)  # convert data to data frame
````````df.to_sql(tablename, engine, schema=schema, if_exists='append')
````def main():
````````df = pd.read_csv('list.csv', header=0, encoding='unicode_escape', sep=',', 
````````lineterminator='\n')
````````mylist = df['Code'].values.tolist()
````````tablename = '2017acs5'
````````getdata(mylist, tablename, 'census')
````main()
You cant wildcard state, county, and tract. So I for loop the state_fips and wildcard county and tract