Comments (8)
Which columns are missing when you get fewer than the example?
from osmnx-examples.
Which columns are missing when you get fewer than the example?
Unfortunately, I did not write headers to the file. I thought that the columns would be uniform.
If you like I have a list of cities and I can give you the respective column lengths if that helps?
Otherwise, I can run it ,again ,and write headers for each file.
from osmnx-examples.
Could you provide a full working example that I can run from scratch to reproduce? List of missing column names would be helpful too.
from osmnx-examples.
UPDATE
File is attached
To run, all you would have to do is this
file_ = pd.read_csv(FILE_PATH_OF_WHEREVER_SAVED_IT)
df = pd.DataFrame(file_,columns = ['Name'])
for value in df.Name:
place = value
gdf = ox.gdf_from_place(place)
area = ox.project_gdf(gdf).unary_union.area
G = ox.graph_from_place(place, network_type='drive_service')
stats = ox.basic_stats(G, area=area)
for k, count in stats['streets_per_node_counts'].items():
stats['int_{}_count'.format(k)] = count
for k, proportion in stats['streets_per_node_proportion'].items():
stats['int_{}_prop'.format(k)] = proportion
# delete the no longer needed dict elements
del stats['streets_per_node_counts']
del stats['streets_per_node_proportion']
file_name = str(counter)
que = pd.DataFrame(pd.Series(stats)).T
with open(file_name + '.csv', 'w') as f:
que.to_csv(f, header=False,index=False,encoding='utf-8')
del stats
del place
del area
del gdf
time.sleep(1000)
Then you could just open off those files and cmd/ctril-right arrow , to get count of rows or you can
path = 'FILE_PATH_OF_WHEREVER_SAVED_IT'
all_files_2 = glob.glob(os.path.join(path, "*.csv"))
df_from_each_file_2 = (pd.read_csv(f,delim_whitespace=True,header=None,names = ['Name']) for f in all_files_2)
concatenated_df_2 = pd.concat(df_from_each_file_2, ignore_index=True)
Name = []
for i in all_files_2:
Name.append(i.rsplit('/',1)[1])
concatenated_df_2['Filename'] = pd.DataFrame(Name)
my = []
for i in concatenated_df_2['Name']:
my.append(i.count(','))
concatenated_df_2['Length'] = pd.DataFrame(my)
concatenated_df_2.head()
CName2 = []
for i in concatenated_df_2.Filename.astype(str):
CName2.append(i.rsplit('.',1)[0])
concatenated_df_2['Clean_Fname'] = pd.DataFrame(CName2)
concatenated_df_2['Length'].value_counts()
##Should give you something like this ##
Forgive me, I may have mis-worded what I meant, by "missing columns"
I thought that after running through 188 places, getting different column lengths was odd.
I thought that their would be place holder values for each column name inside the dict, but I could be wrong.
CLength # of Occurrences
26 86
28 78
30 20
32 4
Name: Column_Length, dtype: int64
The fix for me,( I hope) is to print out the headers of one file for each respective group.
Could you provide a full working example that I can run from scratch to reproduce? List of missing column names would be helpful too.
I thought I already did above.
for value in df.Name:
place = value
Value is a name of a city or place that has a shape file.
Sure, I could give you a list of a few places that give me different column outputs when I write them to a csv.
Updated: See Attached
To run this you would do this
file_ = pd.read_cdv
[geoff.txt](https://github.com/gboeing/osmnx-examples/files/1220628/geoff.txt)
from osmnx-examples.
from osmnx-examples.
I am closing this as a non-issue, from what I can tell, it relates to the size of each place.
from osmnx-examples.
@RockyCD yes. The stats functions return the exact number of elements as specified in the documentation. However, their sub-dicts that contain counts of intersection types and proportions of intersection types (for instance) can contain different numbers of keys. In the example above, one city has an intersection with 5 streets connected to it. The other city does not. Hence the different keys. You got different numbers of columns because you unpack the dicts into flat structures in the code snippet you ran.
from osmnx-examples.
@gboeing That is what I thought. Thank you for your time! What you have built is extremely impressive.( At least to me)
from osmnx-examples.
Related Issues (20)
- Existing alternate isochrones example doesn't respect geometry of curved links HOT 2
- TypeError: unhashable type: 'dict' on first example in 00-osmnx-features-demo.ipynb HOT 5
- Install troubleshooting HOT 1
- TypeError: “Set type is unordered” in isochrones example with Pandas 1.1 HOT 1
- Finding all the edges connected to a node
- multiprocessing doesn't work in Jupyter HOT 1
- osmnx street network polar plot 1 bin backward than histogramas HOT 2
- Download whole state data HOT 1
- Fix binder link from master to main in README.md HOT 1
- Extracting boundaries with specified administrative level is not working correctly HOT 2
- [Question] would it be possible to show a trajectory (moving object) with Osmnx (stream plotting) HOT 1
- Am unable to use osmnx to get data for california, texas and some us state HOT 1
- module 'osmnx' has no attribute 'pois_from_point' HOT 1
- error in notebook 08 HOT 1
- Add Clustering Example by Network Distance HOT 1
- fix: isocrones are not taking into account the time HOT 1
- AttributeError: module 'osmnx' has no attribute 'utils_graph' in 00-osmnx-features-demo.ipynb HOT 2
- examples update needed HOT 2
- Add example of attaching features to nearest nodes
- Add example for OR condition in custom filter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osmnx-examples.