best tool to extract domain hierarchy from a dimension in an OLAP dataset (csv)

2024-01-13 Thread marc nicole via Python-list
Hi all, I have a csv OLAP dataset that I want to extract the domain hierarchies from each of its dimensions. Anybody could recommend a Python tool that could manage this properly? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing a string with comma in one column of CSV file

2022-01-16 Thread Greg Ewing
On 17/01/22 4:18 am, Mats Wichmann wrote: the convention for Excel, which is usually the reason people are using csv, is you can enclose the entire comma-containing field in "quote marks" (afaik it must be double-quote). And to include a double quote in a field, quote the field and

Re: Writing a string with comma in one column of CSV file

2022-01-16 Thread Mats Wichmann
On 1/15/22 13:56, Mahmood Naderan via Python-list wrote: > Hi, > I use the following line to write some information to a CSV file which is > comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(n) + &qu

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Avi Gross via Python-list
Mahmood, Ask yourself WHY you want to do what you are doing. Are you using the power and features of the language or trying to do it step by step in the way that earlier languages often made you do it? Yes, there are ways to include commas in fields of a CSV file and they can lead to

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
lowing line to write some information to a CSV file which > is comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(n) + "," + str(key) + "\n" ) > > > Problem is that key is a strin

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread alister via Python-list
On Sat, 15 Jan 2022 20:56:22 + (UTC), Mahmood Naderan wrote: > Hi, > I use the following line to write some information to a CSV file which > is comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread dn via Python-list
On 16/01/2022 09.56, Mahmood Naderan via Python-list wrote: > Hi, > I use the following line to write some information to a CSV file which is > comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(n)

Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
Hi, I use the following line to write some information to a CSV file which is comma delimited. f = open(output_file, 'w', newline='') wr = csv.writer(f) ... f.write(str(n) + "," + str(key) + "\n" ) Problem is that key is a string which may contain &#

Re: problem reading a CSV file

2021-12-13 Thread Greg Ewing
On 14/12/21 7:07 am, MRAB wrote: It's difficult to say what the problem is when you haven't given us the code! Note: Attachments do not make it to this list. You will need to insert the code into the message as text. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: problem reading a CSV file

2021-12-13 Thread MRAB
On 2021-12-12 23:37, Larry Warner wrote: Win 10, Chrome, Python 3.10.1 New at python error on open statement Probably simple error but I do not see it. The program is a python example with the file name being changed. I want to experiment with changing the literal file name in the open stateme

Re: problem reading a CSV file

2021-12-13 Thread Chris Angelico
On Tue, Dec 14, 2021 at 12:05 AM Larry Warner wrote: > > Win 10, Chrome, Python 3.10.1 > New at python > error on open statement > > Probably simple error but I do not see it. > > The program is a python example with the file name being changed. I want > to experiment with changing the literal fi

problem reading a CSV file

2021-12-13 Thread Larry Warner
Win 10, Chrome, Python 3.10.1 New at python error on open statement Probably simple error but I do not see it. The program is a python example with the file name being changed. I want to experiment with changing the literal file name in the open statement to a variable name later. Larry -- htt

Re: Flask – how to write csv file & save using prefilled value of the filename (response.headers["Content-Disposition"]="attachment; filename=xxx")

2021-08-09 Thread Roland Mueller via Python-list
pe 6. elok. 2021 klo 19.15 MRAB (pyt...@mrabarnett.plus.com) kirjoitti: > On 2021-08-06 16:50, Suretha Weweje wrote: > > I am trying to upload a CSV file with flask, read and process one line > at a > > time while iterating through all rows of the file and write the results >

Re: Flask – how to write csv file & save using prefilled value of the filename (response.headers["Content-Disposition"]="attachment; filename=xxx")

2021-08-06 Thread MRAB
On 2021-08-06 16:50, Suretha Weweje wrote: I am trying to upload a CSV file with flask, read and process one line at a time while iterating through all rows of the file and write the results back to a new CSV file. My python script produces the correct results on its own, but I am not able to

Flask – how to write csv file & save using prefilled value of the filename (response.headers["Content-Disposition"]="attachment; filename=xxx")

2021-08-06 Thread Suretha Weweje
I am trying to upload a CSV file with flask, read and process one line at a time while iterating through all rows of the file and write the results back to a new CSV file. My python script produces the correct results on its own, but I am not able to get the same results when using Flask. I am

Re: How do I read .csv files

2021-03-16 Thread Alan Gauld via Python-list
On 16/03/2021 16:15, The Cool Life wrote: > Try importing the CSV module. That might help! And for the removal of doubt it is spelled csv 9lower case) And it looks like you want to read about the DictReader class within it. The csv module docs include several examples. -- Alan G Author of

Re: How do I read .csv files

2021-03-16 Thread The Cool Life
Try importing the CSV module. That might help! > On Mar 16, 2021, at 6:27 AM, Gys wrote: > > On 3/12/21 11:28 AM, Johann Klammer wrote: >> Specifically ones with quoted strings. I'll have whitespace in >> there and possibly escaped quotechars. >> maybe n

Re: How do I read .csv files

2021-03-16 Thread Benjamin Schollnick
The best answer is to use the CSV library, but there are wrappers around it. For example, I use a wrapper of my own creation (csv_common.py) @ https://github.com/bschollnick/bas_Utilities <https://github.com/bschollnick/bas_Utilities>. The main benefit is that I can create variant CSV’s b

Re: How do I read .csv files

2021-03-16 Thread Gys
gnment, so there'll be whitespaces outside the strings(more than one) ...therefore, csv.DictReader() won't work. I'd like them read into a dict or something.. Hi Johann Klammer, I use Pandas for handling *.csv files pandas documentation : <https://pandas.pydata.org/pandas-docs/

Re: Reading binary data with the CSV module

2020-11-30 Thread MRAB
On 2020-11-30 03:59, Jason Friedman wrote: csv.DictReader appears to be happy with a list of strings representing the lines. Try this: contents = source_file.content() for row in csv.DictReader(contents.decode('utf-8').splitlines()): print(row) Works great, thank you! Question ... wil

Re: Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
> > csv.DictReader appears to be happy with a list of strings representing > the lines. > > Try this: > > contents = source_file.content() > > for row in csv.DictReader(contents.decode('utf-8').splitlines()): > print(row) > Works great, thank you! Question ... will this form potentially use l

Re: Reading binary data with the CSV module

2020-11-29 Thread MRAB
On 2020-11-30 01:31, Jason Friedman wrote: Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding=

Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding='utf-8') as text_file: reader = csv.DictRead

How to convert csv to netcdf please help me python users

2020-05-29 Thread kotichowdary28
Hi all I hope all are doing well please help me how to convert CSV to NetCDF. Im trying but its not working #!/usr/bin/env ipython import pandas as pd import numpy as np import netCDF4 import pandas as pd import xarray as xr stn_precip='ts_sept.csv' orig_precip='ts_sep

Re: Writing output of function to a csv file

2020-05-25 Thread Ciarán Hudson
Thanks, between this message and the one below I was able to understand my error and fix it. I really appreciate the help. -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing output of function to a csv file

2020-05-25 Thread Manfred Lotz
On Mon, 25 May 2020 19:25:08 +0100 MRAB wrote: > On 2020-05-25 19:00, Ciarán Hudson wrote: > > Hi, > > > > In the code below, which is an exercise I'm doing in class > > inheritance, almost everything is working except outputting my > > results, which

Re: Writing output of function to a csv file

2020-05-25 Thread Irv Kalb
xcept outputting my results, which as the >> function stock_count, to a csv. >> stock_count is working in the code. >> And I'm able to open and close the csv called cars, but the stock_count >> output is not being written to the file. >> Any suggestions? > [snip] &

Re: Writing output of function to a csv file

2020-05-25 Thread MRAB
On 2020-05-25 19:00, Ciarán Hudson wrote: Hi, In the code below, which is an exercise I'm doing in class inheritance, almost everything is working except outputting my results, which as the function stock_count, to a csv. stock_count is working in the code. And I'm able to open and

Writing output of function to a csv file

2020-05-25 Thread Ciarán Hudson
Hi, In the code below, which is an exercise I'm doing in class inheritance, almost everything is working except outputting my results, which as the function stock_count, to a csv. stock_count is working in the code. And I'm able to open and close the csv called cars, but the stock_co

Re: creating a csv from information I have printed to screen

2020-05-22 Thread Ciarán Hudson
This has helped a lot; cleaner output, keeping tbl format and creating a csv but the csv is not being populated. Any idea what I am doing wrong? import requests import csv, sys from bs4 import BeautifulSoup cookies = { 'ApplicationGatewayAff

Re: creating a csv from information I have printed to screen

2020-05-22 Thread Peter Otten
Ciarán Hudson wrote: > This has helped a lot; cleaner output, keeping tbl format and creating a > csv but the csv is not being populated. Any idea what I am doing wrong? > writer = csv.writer(sys.stdout) > writer.writerow([ > 'Arriving From' > 'Air

Re: creating a csv from information I have printed to screen

2020-05-22 Thread Peter Otten
Ciarán Hudson wrote: > How do I edit the code below to create a csv file which includes the > information I have printed at the bottom? > > I'm pulling arrival data from an airport website and printing out only the > flight info. I want to save that flight info to a CSV fil

creating a csv from information I have printed to screen

2020-05-21 Thread Ciarán Hudson
How do I edit the code below to create a csv file which includes the information I have printed at the bottom? I'm pulling arrival data from an airport website and printing out only the flight info. I want to save that flight info to a CSV file. import requests from bs4 import Beautifu

Re: error in CSV resetting with seek(0)

2020-05-02 Thread Rahul Gupta
@peter Otten thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: error in CSV resetting with seek(0)

2020-05-01 Thread Peter Otten
Rahul Gupta wrote: > consider the following code > import csv > import numpy as np > > with open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file1, > open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file2: > csv_reader1 =

error in CSV resetting with seek(0)

2020-05-01 Thread Rahul Gupta
consider the following code import csv import numpy as np with open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file1, open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file2: csv_reader1 = csv.DictReader(csv_file1) csv_reader2 =

Re: unable to write content in csv filw

2020-04-27 Thread Cameron Simpson
1: Does the code run to completion without errors? If there's an exception then the data may not get to the file because I/O is normally buffered in memory and written out in larger chunks as the buffer fills i.e. at a time later than your .writerow() call. 2: If you delete the CSV

unable to write content in csv filw

2020-04-27 Thread Rahul Gupta
FOLLWOING IS MY CODE import pandas as pd import csv from sklearn.preprocessing import LabelEncoder from sklearn.feature_selection import chi2 with open("D:\PHD\obranking\\test_chi.csv", 'w') as csvfilew1: fields = ['index', 'feature name', 'p_valu

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-15 Thread sjeik_appie
On 15 Apr 2020 10:28, Peter Otten <__pete...@web.de> wrote: sjeik_ap...@hotmail.com wrote: >    On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote: > >  Rahul Gupta wrote: > >  >for line in enumerate(csv_reader): >  >print(line[csv_reader.

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-15 Thread Peter Otten
sjeik_ap...@hotmail.com wrote: >On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote: > > Rahul Gupta wrote: > > >for line in enumerate(csv_reader): > >print(line[csv_reader.fieldnames[1]]) > > enumerate() generates (index, line) tuples that you need to unpack: >

Re: To apply pca for a large csv

2020-04-14 Thread Oscar Benjamin
On Tue, 14 Apr 2020 at 12:42, Rahul Gupta wrote: > > Hello all, i have a csv of 1 gb which consists of 25000 columns and 2 > rows. I want to apply pca so i have seen sciki-learn had inbuilt > fucntionality to use that. But i have seen to do eo you have to load data in > dat

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-14 Thread sjeik_appie
On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote: Rahul Gupta wrote: > for line in enumerate(csv_reader): > print(line[csv_reader.fieldnames[1]]) enumerate() generates (index, line) tuples that you need to unpack:     for index, line in enumerat

Re: To apply pca for a large csv

2020-04-14 Thread Rahul Gupta
64 bit version -- https://mail.python.org/mailman/listinfo/python-list

Re: To apply pca for a large csv

2020-04-14 Thread Chris Angelico
On Tue, Apr 14, 2020 at 9:41 PM Rahul Gupta wrote: > > Hello all, i have a csv of 1 gb which consists of 25000 columns and 2 > rows. I want to apply pca so i have seen sciki-learn had inbuilt > fucntionality to use that. But i have seen to do eo you have to load data in >

To apply pca for a large csv

2020-04-14 Thread Rahul Gupta
Hello all, i have a csv of 1 gb which consists of 25000 columns and 2 rows. I want to apply pca so i have seen sciki-learn had inbuilt fucntionality to use that. But i have seen to do eo you have to load data in data frame. But my machine is i5 with 8 gb of ram which fails to load all this

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Rahul Gupta
@Peter Thanks alot -- https://mail.python.org/mailman/listinfo/python-list

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Peter Otten
Rahul Gupta wrote: > for line in enumerate(csv_reader): > print(line[csv_reader.fieldnames[1]]) enumerate() generates (index, line) tuples that you need to unpack: for index, line in enumerate(csv_reader): print(line[csv_reader.fieldnames[1]]) If you want to keep track o

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Rahul Gupta
import csv import numpy as np with open("D:\PHD\obranking\\cell_split_demo.csv", mode='r') as csv_file: csv_reader = csv.DictReader(csv_file) print(csv_reader.fieldnames) col_count = print(len(csv_reader.fieldnames)) #print(sum(1 for row in csv_file

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Peter Otten
Rahul Gupta wrote: > On Sunday, April 12, 2020 at 1:35:10 PM UTC+5:30, Rahul Gupta wrote: >> the cells in my csv that i wrote looks likes this >> ['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Rahul Gupta
On Sunday, April 12, 2020 at 1:35:10 PM UTC+5:30, Rahul Gupta wrote: > the cells in my csv that i wrote looks likes this > ['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#505

Re: i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Peter Otten
Rahul Gupta wrote: > the cells in my csv that i wrote looks likes this > ['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433'] > and the cells which are empt

i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data

2020-04-12 Thread Rahul Gupta
the cells in my csv that i wrote looks likes this ['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433'] and the cells which are empty looks like [''] i have trie

Re: low-level csv

2019-11-17 Thread Greg Ewing
On 18/11/19 9:30 am, Dave Cinege wrote: The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example: def csv_split (s): lex = shlex.shlex(s, posix=True) lex.whitespace_split = True lex.whitespace = ',' retur

Re: low-level csv

2019-11-17 Thread Dave Cinege
The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example: def csv_split (s): lex = shlex.shlex(s, posix=True) lex.whitespace_split = True lex.whitespace = ',' return list(lex) will split on co

Re: low-level csv

2019-11-17 Thread Skip Montanaro
On Sun, Nov 17, 2019 at 7:23 AM Antoon Pardon wrote: > > This is python 2.6->2.7 and 3.5->3.7 > > I need to convert a string that is a csv line to a list and vice versa. > I thought to find functions doing this in the csv module but that doesn't > seem to be the c

Re: low-level csv

2019-11-17 Thread Dan Sommers
On 11/17/19 7:18 AM, Antoon Pardon wrote: This is python 2.6->2.7 and 3.5->3.7 I need to convert a string that is a csv line to a list and vice versa. I thought to find functions doing this in the csv module but that doesn't seem to be the case. I can of course write special classes

low-level csv

2019-11-17 Thread Antoon Pardon
This is python 2.6->2.7 and 3.5->3.7 I need to convert a string that is a csv line to a list and vice versa. I thought to find functions doing this in the csv module but that doesn't seem to be the case. I can of course write special classes that would allow for this using a csv

Re: CSV reader ignore brackets

2019-09-26 Thread Piet van Oostrum
Skip Montanaro writes: > How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's > line reading method? (I think I have the re syntax approximately right.) > The csv reader will "just work". Again, nesting parens not allowed. > > Skip

Re: CSV reader ignore brackets

2019-09-25 Thread Skip Montanaro
> Besides, the point isn't the shortest code but to illustrate the idea > of handling special syntax. In my defense, I was typing on my phone while watching a show on Netflix. I was hardly in a position to test any code. :-) As you indicated though, the problem is under-specified (nesting?, pres

Re: CSV reader ignore brackets

2019-09-24 Thread Cameron Simpson
complete :-) Also, that would match FOO(TEST1,TEST2)BAH as well (making FOO"(TEST1,TEST2)"BAH. Which might be wanted, or be not wanted or be bad data (including but not restricted to csv module unparsable data). I was deliberately being very conservative and kind of treating brackets

Re: CSV reader ignore brackets

2019-09-24 Thread Skip Montanaro
How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's line reading method? (I think I have the re syntax approximately right.) The csv reader will "just work". Again, nesting parens not allowed. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV reader ignore brackets

2019-09-24 Thread MRAB
On 2019-09-25 00:09, Cameron Simpson wrote: On 24Sep2019 15:55, Mihir Kothari wrote: I am using python 3.4. I have a CSV file as below: ABC,PQR,(TEST1,TEST2) FQW,RTE,MDE Really? No quotes around the (TEST1,TEST2) column value? I would have said this is invalid data, but that does not help

Re: CSV reader ignore brackets

2019-09-24 Thread Cameron Simpson
On 24Sep2019 15:55, Mihir Kothari wrote: I am using python 3.4. I have a CSV file as below: ABC,PQR,(TEST1,TEST2) FQW,RTE,MDE Really? No quotes around the (TEST1,TEST2) column value? I would have said this is invalid data, but that does not help you. Basically comma-separated rows, where

CSV reader ignore brackets

2019-09-24 Thread Mihir Kothari
Hi Team, I am using python 3.4. I have a CSV file as below: ABC,PQR,(TEST1,TEST2) FQW,RTE,MDE Basically comma-separated rows, where some rows have a data in column which is array like i.e. in brackets. So I need to read the file and treat such columns as one i.e. do not separate based on comma

Re: issue in handling CSV data

2019-09-10 Thread Piet van Oostrum
Sharan Basappa writes: >> >> Note that the commas are within the quotes. I'd say Andrea is correct: >> This is a tab-separated file, not a comma-separated file. But for some >> reason all fields except the last end with a comma. >> However, genfromtxt is not

Re: issue in handling CSV data

2019-09-10 Thread Gregory Ewing
Sharan Basappa wrote: Now, if you see the print after getting the data, it looks like this: ## [['"\t"81' '"\t5c'] ['"\t"04' '"\t11'] ['"\t"e1' '"\t17'] ['"\t"6a' '"\t6c'] ['"\t"53' '"\t69'] ['"\t"98' '"\t87'] ['"\t"5c' '"\t4b'] #

Re: issue in handling CSV data

2019-09-09 Thread Sharan Basappa
gt; > > As you can see, the string "\t"81 is causing the error. > > > > It seems to be due to char "\t". > > > > > > It is not clear what format do you expect to be in the file. > > > You say "it is CSV" so your actual paylo

Re: issue in handling CSV data

2019-09-08 Thread Peter J. Holzer
It seems to be due to char "\t". > > > > It is not clear what format do you expect to be in the file. > > You say "it is CSV" so your actual payload seems to be a pair of three > > bytes (a tab and two hex digits in ASCII) per line. > > The

Re: issue in handling CSV data

2019-09-08 Thread Sharan Basappa
ee, the string "\t"81 is causing the error. > > It seems to be due to char "\t". > > It is not clear what format do you expect to be in the file. > You say "it is CSV" so your actual payload seems to be a pair of three > bytes (a tab and two hex digits i

Re: issue in handling CSV data

2019-09-08 Thread Andrea D'Amore
not clear what format do you expect to be in the file. You say "it is CSV" so your actual payload seems to be a pair of three bytes (a tab and two hex digits in ASCII) per line. Can you paste a hexdump of the first three lines of the input file and say what you expect to get once

Re: issue in handling CSV data

2019-09-07 Thread Sharan Basappa
On Saturday, 7 September 2019 21:18:11 UTC-4, MRAB wrote: > On 2019-09-08 01:19, Sharan Basappa wrote: > > I am trying to read a log file that is in CSV format. > > > > The code snippet is below: > > > > ### > > import matplot

Re: issue in handling CSV data

2019-09-07 Thread MRAB
On 2019-09-08 01:19, Sharan Basappa wrote: I am trying to read a log file that is in CSV format. The code snippet is below: ### import matplotlib.pyplot as plt import seaborn as sns; sns.set() import numpy as np import pandas as pd import os import csv from numpy

Re: issue in handling CSV data

2019-09-07 Thread Joel Goldstick
On Sat, Sep 7, 2019 at 8:28 PM Joel Goldstick wrote: > > On Sat, Sep 7, 2019 at 8:21 PM Sharan Basappa > wrote: > > > > I am trying to read a log file that is in CSV format. > > > > The code snippet is below: > > > > ### &

Re: issue in handling CSV data

2019-09-07 Thread Joel Goldstick
On Sat, Sep 7, 2019 at 8:21 PM Sharan Basappa wrote: > > I am trying to read a log file that is in CSV format. > > The code snippet is below: > > ### > import matplotlib.pyplot as plt > import seaborn as sns; sns.set() > import numpy

issue in handling CSV data

2019-09-07 Thread Sharan Basappa
I am trying to read a log file that is in CSV format. The code snippet is below: ### import matplotlib.pyplot as plt import seaborn as sns; sns.set() import numpy as np import pandas as pd import os import csv from numpy import genfromtxt # read the CSV and get into

Re: print console out to a txt or csv file

2019-02-10 Thread Peter Otten
er import into excel). > > ###A script to list pdf files in a folder > ###gisdude 02/09/19 > ### > import os, sys, glob, csv, pathlib > > ###First, let's change the dir with os > > os.chdir("C:\\Users\\Randy\\Documents\\BOOKS") I have come to the conclusion th

print console out to a txt or csv file

2019-02-10 Thread GISDude
t pdf files in a folder ###gisdude 02/09/19 ### import os, sys, glob, csv, pathlib ###First, let's change the dir with os os.chdir("C:\\Users\\Randy\\Documents\\BOOKS") ###Second, let's now get the list of files in this directory files = glob.glob('*.pdf') for file in

Re: Reading 'scientific' csv using Pandas?

2018-11-20 Thread Martin Schöön
Den 2018-11-19 skrev Martin Schöön : > I spoke too early. Upon closer inspection I get the first column with > decimal '.' and the rest with decimal ','. I have tried the converter > thing to no avail :-( > Problem solved! This morning I woke up with the idea of testing if all this fuss may be cau

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Thomas Jollans
n 'scientific' (xx,xxxe-xx) notation. >>> >> >> Martin, I believe this should be done by pandas itself while reading >> the csv file, >> I took an example in scientific notation and checked this out, >> >> my sample.csv file is, >> col1,col2 >> 1.1,0

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread MRAB
On 2018-11-19 20:44, Martin Schöön wrote: Too many files to go through them with an editor :-( If only Python could read and write files... :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread MRAB
On 2018-11-19 21:32, Martin Schöön wrote: Den 2018-11-19 skrev Martin Schöön : Den 2018-11-19 skrev Peter Otten <__pete...@web.de>: The engine="python" produces an exception over here: """ ValueError: The 'decimal' option is not supported with the 'python' engine """ Maybe you can try and om

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Martin Schöön
Den 2018-11-19 skrev Martin Schöön : > Den 2018-11-19 skrev Peter Otten <__pete...@web.de>: >> >> The engine="python" produces an exception over here: >> >> """ >> ValueError: The 'decimal' option is not supported with the 'python' engine >> """ >> >> Maybe you can try and omit that option? > > Bin

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Martin Schöön
Den 2018-11-19 skrev Peter Otten <__pete...@web.de>: > Martin Schöön wrote: > >> My pandas is up to date. >> > > The engine="python" produces an exception over here: > > """ > ValueError: The 'decimal' option is not supported with the 'python' engine > """ > > Maybe you can try and omit that optio

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Martin Schöön
Too many files to go through them with an editor :-( /Martin -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Chris Angelico
On Tue, Nov 20, 2018 at 7:46 AM Martin Schöön wrote: > Thanks, I just tried this. The line locale.setlocale... throws an > error: > > "locale.Error: unsupported locale setting" > > Trying other ideas instead of 'de' results in more of the same. > '' results in no errors. Haven't been reading in d

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Martin Schöön
ort sys > import pandas > import locale > print( sys.version ) > print( pandas.__version__ ) > with open( 'schoon20181118232102.csv', 'w' ) as file: > print( 'col0\tcol1', file=file, flush=True ) > print( '1,1\t0', file=file, flush=Tr

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Peter Otten
Martin Schöön wrote: > My pandas is up to date. > > In your example you use the US convention of using "." for decimals > and "," to separate data. This works perfect for me too. > > However, my data files use European conventions: decimal "," and TAB > to separate data: > > col1 col2 > 1,1

Re: Reading 'scientific' csv using Pandas?

2018-11-19 Thread Shakti Kumar
n (xxx,xx) but in 'scientific' (xx,xxxe-xx) notation. > >> > > > > Martin, I believe this should be done by pandas itself while reading > > the csv file, > > I took an example in scientific notation and checked this out, > > > > my sample.csv

Re: Reading 'scientific' csv using Pandas?

2018-11-18 Thread Martin Schöön
elieve this should be done by pandas itself while reading > the csv file, > I took an example in scientific notation and checked this out, > > my sample.csv file is, > col1,col2 > 1.1,0 > 10.24e-05,1 > 9.492e-10,2 > That was a quick answer! My pandas is up to date. I

Re: Reading 'scientific' csv using Pandas?

2018-11-18 Thread Shakti Kumar
On Sun, 18 Nov 2018 at 18:18, Martin Schöön wrote: > > I am in this project where I try to get an overview of a bunch of > computer generated (finite element program) data. I have it stored in a > number of csv files. > > Reading the data into spreadsheet programs works fine

Reading 'scientific' csv using Pandas?

2018-11-18 Thread Martin Schöön
I am in this project where I try to get an overview of a bunch of computer generated (finite element program) data. I have it stored in a number of csv files. Reading the data into spreadsheet programs works fine but is very labour intensive so I am working with Pandas in Jupyter notebooks which

Re: I need help to put the output from terminal in a csv file

2018-09-07 Thread catanaangelo
Thanks a lot, I've managed to make it work they way I wanted -- https://mail.python.org/mailman/listinfo/python-list

Re: I need help to put the output from terminal in a csv file

2018-09-07 Thread Rhodri James
On 07/09/18 13:55, catanaang...@gmail.com wrote: HI! I need help putting the output from terminal in a csv file. I work on linux and I have python 2.7.15. I am running a python program which also runs some shell scripts. I need to capture the output from the .sh scripts and put it nicely in a

Re: I need help to put the output from terminal in a csv file

2018-09-07 Thread Brian Oney via Python-list
Please study the following to get you started. It looks like JSON output that you are dealing, which is good. I added a ", to the "body"-line, because I assume that you botched that when giving an example. ```python #!/usr/bin/env python import json output = ''' {    "error" : {   "body"

I need help to put the output from terminal in a csv file

2018-09-07 Thread catanaangelo
HI! I need help putting the output from terminal in a csv file. I work on linux and I have python 2.7.15. I am running a python program which also runs some shell scripts. I need to capture the output from the .sh scripts and put it nicely in a csv table. I am using "commands.getoutput(

Re: how to get a value from CSV specific cell (A7) thanks

2018-09-02 Thread alon . najman
On Saturday, September 1, 2018 at 9:19:29 PM UTC+3, alon@gmail.com wrote: > how to get a value from CSV specific cell (A7) thanks thanks all ! -- https://mail.python.org/mailman/listinfo/python-list

Re: how to get a value from CSV specific cell (A7) thanks

2018-09-02 Thread Peter Otten
alon.naj...@gmail.com wrote: > how to get a value from CSV specific cell (A7) thanks $ cat csv_sheet.py #!/usr/bin/python3 import re import csv import string LOOKUP = {c: i for i, c in enumerate(string.ascii_uppercase, 1)} def a2i(s): """ >>>

Re: how to get a value from CSV specific cell (A7) thanks

2018-09-01 Thread George Fischhof
HI, CSV has no cells, but you can use csv module from standard lib https://docs.python.org/3/library/csv.html and you can get 7th data from the first row (as A means the first row) __george__ ezt írta (időpont: 2018. szept. 1., Szo, 20:24): > how to get a value from CSV specific cell

how to get a value from CSV specific cell (A7) thanks

2018-09-01 Thread alon . najman
how to get a value from CSV specific cell (A7) thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem of writing long list of lists file to csv

2018-05-22 Thread subhabangalore
On Tuesday, May 22, 2018 at 3:55:58 PM UTC+5:30, Peter Otten wrote: > > > > lst2=lst1[:4] > > with open("my_csv.csv","wb") as f: > > writer = csv.writer(f) > > writer.writerows(lst2) > > > > Here it is writing only the first four lists. > > Hint: look at the first line

  1   2   3   4   5   6   7   8   9   10   >