Re: tree representation of Python data

2023-02-08 Thread Shaozhong SHI
What is the robust way to use Python to read in an XML and turn it into a JSON file? JSON dictionary is actually a tree. It is much easier to manage the tree-structured data. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Missing global # gdal DRIVER_NAME declaration in gdal_array.py

2022-03-08 Thread Shaozhong SHI
The following warning kept coming up when running ogr2ogr. Warning 1: Missing global # gdal: DRIVER_NAME declaration in C:\Users\AppData\Local\Programs\Python\Python36\Lib\site-packages\osgeo\gdal_array.py What steps to be take to resolve this issue? Regards, David -- https://mail.python.org/m

Issues of pip install gdal and fiona

2022-03-06 Thread Shaozhong SHI
I downloaded .whl files for fiona and gdal to go with Python3.6.5. However, I am having trouble with red error messages. Though Gdal is now working, there is a warning message - Missing global ~ gdal: DRIVER_NAME declaration gdal_array,py Can anyone advise on how to resolve the issues? Regard

Re: Re: Long running process - how to speed up?

2022-02-20 Thread Shaozhong SHI
On Sat, 19 Feb 2022 at 18:51, Alan Gauld wrote: > On 19/02/2022 11:28, Shaozhong SHI wrote: > > > I have a cvs file of 932956 row > > That's not a lot in modern computing terms. > > > and have to have time.sleep in a Python > > script. > > Why? Is it

Re: Long running process - how to speed up?

2022-02-20 Thread Shaozhong SHI
On Sat, 19 Feb 2022 at 19:44, Mats Wichmann wrote: > On 2/19/22 05:09, Shaozhong SHI wrote: > > Can it be divided into several processes? > > Regards, > > David > > The answer is: "maybe". Multiprocessing doesn't happen for free, you > have to fi

Re: Long running process - how to speed up?

2022-02-19 Thread Shaozhong SHI
Can it be divided into several processes? Regards, David On Saturday, 19 February 2022, Chris Angelico wrote: > On Sat, 19 Feb 2022 at 22:59, Karsten Hilbert > wrote: > > > > > > I have a cvs file of 932956 row and have to have time.sleep in a > Python > > > > script. It takes a long time to p

Long running process - how to speed up?

2022-02-19 Thread Shaozhong SHI
I have a cvs file of 932956 row and have to have time.sleep in a Python script. It takes a long time to process. How can I speed up the processing? Can I do multi-processing? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

URLError:

2022-02-12 Thread Shaozhong SHI
The following is used in a loop to get response code for each url. print (urllib.request.urlopen(url).getcode()) However, error message says: URLError: Python 3.6.5 is being used to test whether url is live or not. Can anyone shed light on this? Regards, David -- https://mail.python.org/mai

Re: How to set environmental variables for Python

2022-01-17 Thread Shaozhong SHI
Set Operation System but not disturbing existing setting. Only to add at the command line. Regards, David On Mon, 17 Jan 2022 at 10:57, dn via Python-list wrote: > On 17/01/2022 22.31, Shaozhong SHI wrote: > > I got quite a few version of Python on my machine. > > &

How to set environmental variables for Python

2022-01-17 Thread Shaozhong SHI
I got quite a few version of Python on my machine. How do I set environmental variables for Python 3.6.1 to work? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Can Python call and use FME modules and functions such as StreamOrderCalculator?

2021-12-23 Thread Shaozhong SHI
Can we do something like import an fme.something and make use of FME modules and functions? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

ogr2ogr can not open gfs file when loading GML

2021-12-14 Thread Shaozhong SHI
My command line kept telling me that it ogr2ogr can not open gfs file. It does find it. I was trying to load GML onto PostGIS. Alternatively, how to specify XSD file to go along with reading GML files? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Installation of GeoPandas - failed at fiona

2021-12-01 Thread Shaozhong SHI
I am trying to install geopandas. I navigated to c:\programData|Anaconda3\Scripts> and typed in 'pip install geopandas'. It ran but failed at fiona. I tried import geopandas as gp, but Error Message says: No module names 'geopandas'. Can anyone help? Regards, David -- https://mail.python.org

Re: System, configuration and Python performance

2021-11-01 Thread Shaozhong SHI
On Tue, 2 Nov 2021 at 00:20, Shaozhong SHI wrote: > > > On Tue, 2 Nov 2021 at 00:09, MRAB wrote: > >> On 2021-11-01 23:02, Shaozhong SHI wrote: >> > How to configure to improve Python performance in a system like the >> > following: >> > >>

Re: System, configuration and Python performance

2021-11-01 Thread Shaozhong SHI
On Tue, 2 Nov 2021 at 00:09, MRAB wrote: > On 2021-11-01 23:02, Shaozhong SHI wrote: > > How to configure to improve Python performance in a system like the > > following: > > > > Windows 10 > > > > System > > > > Processor Intel(R) Core(TM)

System, configuration and Python performance

2021-11-01 Thread Shaozhong SHI
How to configure to improve Python performance in a system like the following: Windows 10 System Processor Intel(R) Core(TM) i7-9700 CPU @3.60GHz, 3.60 GHz Installed memory (RAM) 32.0 GB (31.8 GB usable) System type: 64-bit Operating System, x64-based processor I found that the Python script wa

Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sun, 31 Oct 2021 at 18:42, Shaozhong SHI wrote: > > > On Sunday, 31 October 2021, Albert-Jan Roskam > wrote: > >> >> >> > df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1) >> >> >> I think you need ax

Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sun, 31 Oct 2021 at 19:28, MRAB wrote: > On 2021-10-31 18:48, Shaozhong SHI wrote: > > > > On Sunday, 31 October 2021, MRAB wrote: > > > > On 2021-10-31 17:25, Shaozhong SHI wrote: > > > > I defined a function and apply it to a column

Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sunday, 31 October 2021, MRAB wrote: > On 2021-10-31 17:25, Shaozhong SHI wrote: > >> I defined a function and apply it to a column in Pandas. But it does not >> return correct values. >> >> I am trying to test which url in a column full of url to see which one

Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sunday, 31 October 2021, Albert-Jan Roskam wrote: > > > > df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1) > > > I think you need axis=0. Or use the Series, df['URL'] = > df.URL.apply(connect) > Any details? I will try and let you know. Regards, David -- https://mail.python.org/ma

How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
I defined a function and apply it to a column in Pandas. But it does not return correct values. I am trying to test which url in a column full of url to see which one can be connected to or not def connect(url): try: urllib.request.urlopen(url) return True except:

Re: Python script seems to stop running when handling very large dataset

2021-10-30 Thread Shaozhong SHI
On Saturday, 30 October 2021, Dieter Maurer wrote: > Shaozhong SHI wrote at 2021-10-29 23:42 +0100: > >Python script works well, but seems to stop running at a certain point > when > >handling very large dataset. > > > >Can anyone shed light on this? > > Som

Python script seems to stop running when handling very large dataset

2021-10-29 Thread Shaozhong SHI
Python script works well, but seems to stop running at a certain point when handling very large dataset. Can anyone shed light on this? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

How to store the result of df.count() as a new dataframe in Pandas?

2021-10-26 Thread Shaozhong SHI
Hello, The result of df.count() appears to be a series object. How to store the result of df.count() as a new dataframe in Pandas? That is data anyhow. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

df.count() to a Pandas dataframe with column names

2021-10-21 Thread Shaozhong SHI
How to output the result of df.count() to a Pandas dataframe with column names? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Alternatives to Jupyter Notebook

2021-10-20 Thread Shaozhong SHI
Hello, Is anyone familiar with alternatives to Jupyter Notebook. My Jupyter notebook becomes unresponsive in browsers. Are there alternatives to read, edit and run Jupyter Notebook? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

SQLAlchemy fault

2021-10-20 Thread Shaozhong SHI
I read a txt file into Pandas Dataframe, and found a lot of nulls in a column. Then, I used SQLAlchemy and psycopg2. I created engine. I loaded data onto PostgreSQL. Strange thing happened. The column has no null at all. Does it mean that the data has been modified somewhere along the line?

Connecting to MS accdb and read data into Pandas

2021-10-12 Thread Shaozhong SHI
I tried the following code: import pyodbc conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\my.accdb;') cursor = conn.cursor() cursor.execute('select * from table_name') for row in cursor.fetchall(): print (row) But I could not connect to .accdb. What is the

Re: Definitive guide for Regex

2021-10-01 Thread Shaozhong SHI
? Regards, David On Thu, 30 Sept 2021 at 22:02, Barry Scott wrote: > > > > On 30 Sep 2021, at 19:35, dn via Python-list > wrote: > > > > On 01/10/2021 06.16, Barry Scott wrote: > >> > >> > >>> On 30 Sep 2021, at 12:29, Shaozhong SHI >

Definitive guide for Regex

2021-09-30 Thread Shaozhong SHI
Dear All, I am trying to look for a definitive guide for Regex in Python. Can anyone help? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Automated data testing, checking, validation, reporting for data assurance

2021-09-29 Thread Shaozhong SHI
There appear to be a few options for this. Has anyone tested and got experience with automated data testing, validation and reporting? Can anyone enlighten me? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Observing long running processes of Jupyter Notebook

2020-12-03 Thread Shaozhong SHI
We have been running Jupyter Notebook processes, which take long time to run. We use nbconvert to run these in commandline. Nbconvert only writes output into a file at the end. We just wonder whether there is a way to observe the progress and printing messages when nbconvert is running. Regards

How to run Jupyter notebook in command line and get full error message?

2020-11-28 Thread Shaozhong SHI
How to run Jupyter notebook in command line and get full error messages? My VPN keeps dropping and can not run Jupyter Notebook as it is. I started to use nbconvert in command line. But, when it stops due to error, I can not see where the error occurs. In order to make life easier for debugging

How to record full error message for debugging with nbconvert?

2020-11-28 Thread Shaozhong SHI
Hi, When I use nbconvert to run Jupyter notebook, it is so difficult to see the full error message for debugging? How to save full error messages? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

ssl connection has been closed unexpectedly

2020-11-28 Thread Shaozhong SHI
Hi, I keep getting the following error when I use engine = create_engine(logging in details to postgres) df.to_sql('table_name', and etc.) OperationalError: (psycopg2.OperationalError) SSL connection has been closed unexpectedly (Background on this error at: http://sqlalche.me/e/13/e3q8) Operat

Re: Questions about XML processing?

2020-11-07 Thread Shaozhong SHI
Hi, Hernan, Did you try to parse GML? Surely, there can be very concise and smart ways to do these things. Regards, David On Fri, 6 Nov 2020 at 20:57, Hernán De Angelis wrote: > Thank you Terry, Dan and Dieter for encouraging me to post here. I have > already solved the problem albeit with a

Dataframe to postgresql - Saving the dataframe to memory using StringIO

2020-10-22 Thread Shaozhong SHI
I found this last option is very interesting. Saving the dataframe to memory using StringIO https://naysan.ca/2020/06/21/pandas-to-postgresql-using-psycopg2-copy_from/ But, testing shows unicode argument expected, got 'str' Any working example for getting DataFrame into a PostgreSQL table direc

How to write differently to remove this type hint in Python 2.7?

2020-10-21 Thread Shaozhong SHI
Is there another way to do this? def greet(name: str) -> str: return "Hello, " + name greet File "", line 1 def greet(name: str) -> str: ^ SyntaxError: invalid syntax -- https://mail.python.org/mailman/listinfo/python-list

How to expand and flatten a nested of list of dictionaries of varied lengths?

2020-10-18 Thread Shaozhong SHI
Even worse is that, in some cases, an addition called serviceRatings as a key occur with new data unexpectedly. How to produce a robust Python/Panda script to coping with all these? Regards, David u'historicRatings': [{u'overall': {u'keyQuestionRatings': [{u'name': u'Safe', u'rating': u'Require

Are there Python ways to execute queries on PostgreSQL without getting data over?

2020-10-18 Thread Shaozhong SHI
Are there Python ways to execute queries on PostgreSQL without getting data over? Are there ways just to fire off PostgreSQL queries and not get data into Python? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Re: ValueError: arrays must all be same length

2020-10-05 Thread Shaozhong SHI
tten table? Apparently, the nested data is another table. Regards, Shao On Sun, 4 Oct 2020 at 13:55, Tim Williams wrote: > On Sun, Oct 4, 2020 at 8:39 AM Tim Williams wrote: > > > > > > > On Fri, Oct 2, 2020 at 11:00 AM Shaozhong SHI > > wrote: > >

How to handle a dictionary value that is a list

2020-10-02 Thread Shaozhong SHI
Hi, All, I was trying to handle the value of "personRoles" in a part of json dictionary. Can anyone tell me various ways to handle this? Regards, Shao "regulatedActivities": [ { "name": "Accommodation for persons who require nursing or personal care", "code": "RA2", "con

ValueError: arrays must all be same length

2020-10-02 Thread Shaozhong SHI
Hello, I got a json response from an API and tried to use pandas to put data into a dataframe. However, I kept getting this ValueError: arrays must all be same length. Can anyone help? The following is the json text. Regards, Shao { "locationId": "1-1004508435", "providerId": "1-101641521

Any good explanations on pd.merge(df,df2, on=['Code', 'Region'])

2017-11-08 Thread David Shi via Python-list
I am trying to gain a clear understanding on pd.merge(df,df2, on=['Code', 'Region']). Can anyone assist? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

How to get values for skos/note, skos/notation and label in N-Triples

2017-09-05 Thread David Shi via Python-list
"Baginton E04009817"@en . "Live" .

Can some one give examples of how to use graph.label to get data values while dealing with N-Triples files?

2017-09-04 Thread David Shi via Python-list
How to used graph.label to get data values like 'Baddesley Clinton E04009816'? "Baddesley Clinton E04009816"@en .

How best to search and get values of label in N-Triples

2017-09-04 Thread David Shi via Python-list
I have a parsed N-Triples file, having many items like the following. "Baddesley Clinton E04009816"@en .

Looking for Python examples for querying, selecting items in N-Triples

2017-09-04 Thread David Shi via Python-list
I found this is very confusing. I will appreciate if simple examples are given. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Select data in N-Triples

2017-09-01 Thread David Shi via Python-list
in a N-Triples file, there are a lot lines like the following: "Baginton E04009817"@en .

rdflib, N-Triples and Pandas

2017-09-01 Thread David Shi via Python-list
How best to use rdflib to parse N-Triples files and turn them into Pandas tables? Looking forward to hearing from you. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Is there tested Python code for parsing N-Triples?

2017-08-31 Thread David Shi via Python-list
Is there tested Python code for parsing N-Triples? Looking forward to hearing from you. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

How to make sure the result of Pandas.to_csv does not have non-ASCII code?

2017-05-31 Thread David Shi via Python-list
How to make sure the result of Pandas.to_csv does not have non-ASCII code? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Pressing dot and show sub command in IPython

2017-04-18 Thread David Shi via Python-list
Hi, Matt, How to make IPython work more interactively? As I remember, pressing dot and sub command shows up suggestively in IPython. But, now, after re-installing IPython notebook, it does not do so any more. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/li

How to do pd.read_csv with consecutive spaces or semi-colon as delimiters?

2017-04-18 Thread David Shi via Python-list
Any way to do that? The link to a sample dataset is as follows: http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-lis

[no subject]

2017-04-13 Thread David Shi via Python-list
Which VCF reader has been well tested and proven to be robust? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

[no subject]

2017-04-13 Thread David Shi via Python-list
13.1. csv — CSV File Reading and Writing — Python 2.7.13 documentation | | | 13.1. csv — CSV File Reading and Writing — Python 2.7.13 documentation | | | I am trying to parse this text file into a table. How to use consecutive 3 spaces to work as delimiter with csv.reader? Looking f

Reading structured text file (non-CSV) into Pandas Dataframe

2017-04-13 Thread David Shi via Python-list
http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text The above is a web link to a structured text file.  It is not a CSV. How can this text file be read into a Pandas Dataframe, so that further processing can be made? Looking

Read a text file into a Pandas DataFrame Table

2017-04-13 Thread David Shi via Python-list
Dear All, Can anyone help to read a text file into a Pandas DataFrame Table? Please see the link below. http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text Regards. David -- https://mail.python.org/mailman/listinfo/python-l

How to pd.read_csv into a DataFrame with multiple seperators?

2017-04-12 Thread David Shi via Python-list
Have a look at this example. http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text How to pd.read_csv into a DataFrame with multiple seperators? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

XML tree to a pandas dataframe

2017-04-12 Thread David Shi via Python-list
What is the best way to convert XML document into a pandas dataframe? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Pound sign problem

2017-04-10 Thread David Shi via Python-list
In the data set, pound sign escape appears: u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', When using table.to_csv after importing pandas as pd, an error message persists as follows: UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in ra

A Python solution for turning a web page into Pandas DataFrame table

2017-04-07 Thread David Shi via Python-list
Is there a Python solution for turning a web page into Pandas DataFrame table? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

[no subject]

2017-04-07 Thread David Shi via Python-list
I was using IPython notebooks.  All the sudden, it asks for password or token. I did not set any password or token. How do I get back to use my IPython notebooks? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: How to capture a CSV file and read it into a Pandas Dataframe?

2017-04-05 Thread David Shi via Python-list
there a way to capture the file? Regards. David On Wednesday, 5 April 2017, 17:19, Skip Montanaro wrote: I'm not positive, but try passing response to read_csv() instead of reading the bytes yourself. Skip On Apr 5, 2017 10:38 AM, "David Shi via Python-list" wrote:

How to capture a CSV file and read it into a Pandas Dataframe?

2017-04-05 Thread David Shi via Python-list
I tried the following codes: import urllib2response = urllib2.urlopen('http://cordis.europa.eu/search/result_en?q=uk&format=csv')myCSV = response.read() myFile = pd.read_csv(myCSV) but, it did not work well. Can any one help? Regards. David -- https://mail.python.org/mailman/listinfo/python-l

How to make use of .egg files?

2017-04-05 Thread David Shi via Python-list
Can anyone explain please. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex?

2017-03-20 Thread David Shi via Python-list
Hi, there, Can anyone help? How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex? For instance, a ZIP code 33132 was found and replaced with 33. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/lis

Two constructive reviewers sought

2016-07-27 Thread David Shi via Python-list
To promote the use of Python and formalise Python approach, I decided to publish a paper. I used geodata as a showcase. Geodata lies in the heart of geographical information science.  The management and processing of such data is of great importance. I got an email from International Journal of

Live installation of Pandas for Windows 64

2016-06-27 Thread David Shi via Python-list
Is there a live installation of Pandas for Windows 64? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

JSON to Pandas data frame

2016-06-25 Thread David Shi via Python-list
How to convert a JSON object into a Pandas data frame? I know that for XML, there are XML parsers. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to reset IPython notebook file association

2016-06-25 Thread David Shi via Python-list
I use IPython Notebook to do Python programming. I used "Open with" and set it with Google Chrome.  Then, my IPython notebook does not load properly. How can I reset IPython notebook file association, so that I can use it again? Looking forward to hearing from you. Regards. David -- https://mail.

Which one is the best JSON parser?

2016-06-23 Thread David Shi via Python-list
Can any one tell me? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Which one is the best XML-parser?

2016-06-23 Thread David Shi via Python-list
Which one is the best XML-parser? Can any one tell me? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Pandas to CSV and .dbf

2016-06-23 Thread David Shi via Python-list
Has anyone tested on Pandas to CSV and .dbf lately? I am looking for proven, tested examples to output Panda Data Frame to CSV and dbf files. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Pandas GroupBy does not behave consistently

2016-05-15 Thread David Shi via Python-list
ues On Sat, May 14, 2016, 11:40 AM David Shi wrote: Hello, Michael, Why there is a little u ?  u'ID',? Why can be done to it?  How to handle such objects? Can it be turn into list easily? Regards. David On Saturday, 14 May 2016, 15:34, Michael Selik wrote: You might also be i

Re: How to put back a number-based index

2016-05-14 Thread David Shi via Python-list
d an error? What was the error message? Have you tried a Google search for "pandas set index"?http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html On Fri, May 13, 2016 at 11:18 PM David Shi wrote: Hello, Michael, I tried to discover the problem. df[0]  

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael, This is very weird. 55 145340.20 56 25.43 Name: 3, dtype: float64 It looks like two columns, but it shows one single object. Any clue? On Saturday, 14 May 2016, 4:15, David Shi wrote: Hello, Michael, I tried to discover the

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael, I do not understand this. I tried list =df[3] it worked.  But, it does not behave like a list. list[0] nothinglist[1] a valuelist[2] nothing list[4] a value It behaves like a dictionary. On Saturday, 14 May 2016, 4:27, David Shi wrote: Hello, Michael, This is very weird

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Selik wrote: What have code you tried? What error message are you receiving? On Fri, May 13, 2016, 5:54 PM David Shi wrote: Hello, Michael, How to convert a float type column into an integer or label or string type? On Friday, 13 May 2016, 22:02, Michael Selik wrote: To clarify that

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
=list('abcd'))    >>> df        X    a  0    b  1    c  2    d  3    >>> df.loc['a']    X    0    Name: a, dtype: int64    >>> df.iloc[0]    X    0    Name: a, dtype: int64 On Fri, May 13, 2016 at 4:54 PM David Shi wrote: Dear Michael, To avoid co

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
        index  data    group    A         y     2    B         z     3 If that doesn't help, you'll need to explain what you're trying to accomplish in detail -- what variables you started with, what transformations you want to do, and what variables you hope to have when finish

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
7;MT',u'NC',u'ND',u'NE', u'NH',u'NJ',u'NM',u'NV',u'NY',u'OH',u'OK', u'OR',u'PA',u'RI',u'SC

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
7;WV', u'WY']], labels=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 1

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
at 3:56 PM Michael Selik wrote: In order to preserve your index after the aggregation, you need to make sure it is considered a data column (via reset_index) and then choose how your aggregation will operate on that column. On Fri, May 13, 2016 at 3:29 PM David Shi wrote: Hello, Michael, Why r

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
choose how your aggregation will operate on that column. On Fri, May 13, 2016 at 3:29 PM David Shi wrote: Hello, Michael, Why reset_index before grouping? Regards. David On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael, Why reset_index before grouping? Regards. David On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote: I lost my indexes after grouping in Pandas. I managed to rest_index and got back the index column

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael,Thank you.  Yes, aster grouping I lost my indexing in both x, y directions. How to convert a row, and a column into indexes or labels? On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote: I lost my

How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
I lost my indexes after grouping in Pandas. I managed to rest_index and got back the index column. But How can I get back a index row? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to call a Python Class?

2016-05-03 Thread David Shi via Python-list
I found a Python class within an Open Source software. I would like to use it in my own Python script. I tried to import it, but I got following message. from intersection import *Traceback (most recent call last):  File "", line 1, in     from intersection import *ImportError: bad magic number i

How to fill in abbreviation in one column based on state name in another column?

2016-05-01 Thread David Shi via Python-list
Hello, I am back.  Thank you very much for your positive response. I am trying to use Pandas apply to execute a lookup function, so that we can put abbreviation in a new column, in accordance to a state name in another column. Does anyone knows how to make this to work? Regards.DavidLook up funct

How to fill in abbreviation in one column based on state name in another column?

2016-04-30 Thread David Shi via Python-list
I am trying to use apply to execute a lookup function, so that we can put abbreviation in a new column, in accordance to a state name in another column. Does anyone knows how to make this to work? Regards. David state_to_code = {"VERMONT": "VT", "GEORGIA": "GA", "IOWA": "IA", "Armed Forces Pacifi

Pivot table of Pandas

2016-04-28 Thread David Shi via Python-list
Hello, Matt, Please see the web link.Pandas Pivot Table Explained |   | |   |   |   |   |   | | Pandas Pivot Table ExplainedExplanation of pandas pivot_table function. | | | | View on pbpython.com | Preview by Yahoo | | | |   | Debra and Fred have their own groups. How to split the pivot

Simplest way to locate a string in a column and get the value on the same row in another column

2016-04-28 Thread David Shi via Python-list
What is the simplest way to locate a string in a column and get the value on the same row in another column ? 1  a2  b3  c Locate b and obtain 2 in a table. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

ONE CLICK REST API

2016-04-03 Thread David Shi via Python-list
Eclipse has got one click app for creating REST services. What is it equivalent in Python? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Which plugin allows quick creation of secure REST services?

2016-03-31 Thread David Shi via Python-list
Hello,  Which plugin allows quick creation of secure REST services?  so that Python scripts can be attached to it. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

IPython and Jupyter

2016-03-29 Thread David Shi via Python-list
Ipython-4.1.2 I thought that I installed Ipython. I typed in ipython notebook. But a WARNING came up, saying Subcommand 'ipython notebook is deprecated and will be removed in future versions. Then Jupyter turned up. How can I make available both Ipython notebook and Jupyter?, so that I can switch

Simple, fast responsive, secure way of creating REST services

2016-03-29 Thread David Shi via Python-list
Hello, Justin, What you said is very interesting and useful. I just wonder whether there are much simpler alternatives for fast, responsive, secure REST services.  Python at server-side.  It provides REST services.  Data exchange with the web--page.  Formatted XML or Json. Ideally, it uses the le

Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-28 Thread David Shi via Python-list
Has anyone done a recent reviews of creating REST services, in Python? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Is there a way to execute shell commands on VMWare server via PyVMomi?

2015-02-11 Thread Johnny Ting Shi
We have some VM running on top of EXSi. We want to be to run some remote arbitrary commands on the VM, anyone has experience with https://github.com/vmware/pyvmomi? which command do i need to call? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Get the selected tab in a enthought traits application

2013-09-15 Thread shi
Any ideas? I think you will have more chance for an answer in a more specialized list, e.g. the enthought-dev mailing list, which is also accessible via gmane: http:// dir.gmane.org / gmane.comp.python.enthought.devel Stefaan. -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >