I am trying to create a number of folders from a csv file and then run a python script inside each. The following code is to create the folders. It runs but doesn't create anything!
import errno
import os
import csv
import pandas as pd
mountains_column_name = "mountains"
#read from the csv of mountains
data = pd.read_csv('1500mountains.csv', encoding='utf8')
#column called mountains has the names:
if mountains_column_name not in data.columns:
raise ValueError("Missing Mountain column in input data")
mountains = data[mountains_column_name].tolist()
def mkdir_p(mountains):
try:
os.makedirs('\vince\Desktop\WhatMountainThat\dataset')
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and
os.path.isdir('\vince\Desktop\WhatMountainThat\dataset'):
pass
else:
raise
mkdir_p(mountains)
I'd forgotten to call mkdir! When I call it now I get the following :
TypeError: mkdir_p() missing 1 required positional argument: 'mountains'
mkdir_p(mountains)?pandashere?