Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Jan 27, 2019 13:11
:)
Jan 27, 2019 13:08
add comment=''
Jan 27, 2019 13:08
how can i remove it
Jan 27, 2019 13:05
why the # and how can i get ride of it
Jan 27, 2019 13:05
# value1,value2,value3
Jan 27, 2019 13:05
the np.savetxt adds # at the beginning of the csv header. The header is
Jan 27, 2019 13:04
how can i remove it
Jan 27, 2019 13:04
there is a "#" at the beginning of the header in this line np.savetxt('File1.csv',a, header="value1,value1,value3", delimiter=',', fmt='%s')
Jan 27, 2019 13:02
thanks
Jan 27, 2019 12:58
Wow
Jan 27, 2019 12:57
can you give me an idea on your statement "there might be even better options"?
Jan 27, 2019 12:56
i suppose, i will stick to append then!
Jan 27, 2019 12:55
tried the reshape but didn't work. How faster extend than append?
Jan 27, 2019 12:54
nested loop through a very large dataset, extracting the 3 values through long calculations and saving them to a csv file with 3 columns, n-rows (np.savetxt statement)
Jan 27, 2019 12:49
what other options are there with numpy?
Jan 27, 2019 12:49
thanks, but i read that .extend is faster than .append
Jan 27, 2019 12:38
I would like to reshape the output of a.extend((value1[index1], value2[index2], value3[index3])) to three columns and n rows. Currently "a" puts each value on a row. Any idea?
Jan 24, 2019 12:10
once I do the 2nd loop, I want to only consider a certain value
Jan 24, 2019 12:09
now I have another error though
Jan 24, 2019 12:09
the 2nd one (range_data) and (azimuth_data) worked. Thanks
Jan 24, 2019 12:07
I want to loop over range_data and azimuth_data. How can i do it?
Jan 24, 2019 12:05
range is saved as range_data (range is a python name and can't be used). range_data has values (0.0, 999.0, 1998.0, etc)
Jan 24, 2019 11:55
--> 152 for i in range(range_data): #take the first range
153 for j in range(azimuth_data): #iterate over all 360 azimuth

TypeError: only integer scalar arrays can be converted to a scalar index
Jan 24, 2019 11:53
when looping over range, azimuth i am getting this error
Jan 24, 2019 11:52
i do have the code
Jan 24, 2019 11:32
Hi, i am reading a file with polar coordinates and converting it to (Long, Lat). I want to loop over (range, azimuth) and save to csv only if a certain variable is above a certain limit. Can anyone guide me?
Jan 13, 2019 12:47
that is true
Jan 13, 2019 12:36
and i am working on it. Thanks for your help
Jan 13, 2019 12:35
I already have the work done for each file alone. I just need to batch it
Jan 13, 2019 12:34
don't know otherwise
Jan 13, 2019 12:32
you can do that, I have to use the loops
Jan 13, 2019 12:31
I wasn't asking you to do it, rather asking for advice if i can make a new for loop or add to the existing one
Jan 13, 2019 12:30
I am working on it, @rog
Jan 13, 2019 12:28
i will create a new loop to read each csv and perform rest of the tasks.
Jan 13, 2019 12:27
part 1 is done
Jan 13, 2019 12:27
1)convert and manupliate files to csv, 2) add a new column to each csv (calculation from 3rd column), 4) re-arrange the columns from (lat, lon, water) to (lon, lat, water, calc)
Jan 13, 2019 12:20
now, i want to read the csvs (batch) as pandas to add the header and perform calculations and then change switch the places of (lat, lon) to (lon, lat). Can i do that within the last WITH OPEN?
Jan 13, 2019 12:16
what is weird, in the new code, I didn't add the file size limits and it doesn't give me errors!!!!!
Jan 13, 2019 12:15
YESSSSSS, and thanks to you
Jan 13, 2019 12:13
changed '/outputs/' to '//' and it worked. thanks!
Jan 13, 2019 12:09
but yesterday, it didn't write the word outputs at the beginning of the filename!!!
Jan 13, 2019 12:09
for me to make the code run yesterday, I had to change the following: '/outputs/' to '\outputs'
Jan 13, 2019 12:07
sorry. When removing the entire '\outputs' the code excute with no errors but no csvs appear in the directory!
Jan 13, 2019 12:07
@roganjosh, when removing the '\outputs
Jan 13, 2019 12:06
I tried to remove the '\outputs' from the 2nd WITH OPNE but it didn't work
Jan 13, 2019 12:05
@roganjosh, it worked but adds the word outputs at the beginning of the file name
Jan 13, 2019 11:43
let's try it
Jan 13, 2019 11:43
no, unless it complicates things down the road for me. I have few more calculations to perform on each csv
Jan 13, 2019 11:42
elev=water
Jan 13, 2019 11:41
yes