Skip to content

Commit

Permalink
import from url
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnfarrell committed Mar 31, 2018
1 parent 64c2055 commit 48a3856
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
24 changes: 23 additions & 1 deletion pandastable/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def createMenuBar(self):
'05Save As':{'cmd':self.saveasProject},
'06sep':'',
'07Import CSV':{'cmd':self.importCSV},
'08Import from URL':{'cmd':self.importURL},
'08Import Excel':{'cmd':self.importExcel},
'09Export CSV':{'cmd':self.exportCSV},
'10sep':'',
Expand Down Expand Up @@ -560,6 +561,17 @@ def importCSV(self):
table.importCSV(dialog=True)
return

def importURL(self):
"""Import CSV from URL"""

url = simpledialog.askstring("Import url", "Input CSV URL",
parent=self.master)
if url is not None:
name = os.path.basename(url)
df = pd.read_csv(url)
self.addSheet(sheetname=name, df=df, select=True)
return

def exportCSV(self):
"""Import csv to a new sheet"""

Expand Down Expand Up @@ -978,6 +990,12 @@ def _call(self, func, **args):
getattr(table, func)(**args)
return

def _check_snap(self):
if os.environ.has_key('SNAP_USER_COMMON'):
print ('running inside snap')
return True
return False

def about(self):
"""About dialog"""

Expand All @@ -999,9 +1017,13 @@ def about(self):
pandasver = pd.__version__
pythonver = platform.python_version()
mplver = matplotlib.__version__
if self._check_snap == True:
snap='(snap)'
else:
snap=''

text='DataExplore Application\n'\
+'version '+__version__+'\n'\
+'version '+__version__+snap+'\n'\
+'Copyright (C) Damien Farrell 2014-\n'\
+'This program is free software; you can redistribute it and/or\n'\
+'modify it under the terms of the GNU General Public License\n'\
Expand Down
4 changes: 2 additions & 2 deletions pandastable/plugins/remotedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
import pandas as pd
import pylab as plt
from collections import OrderedDict
from pandastable.dialogs import *
#from pandastable.dialogs import *

class DataReaderPlugin(Plugin):
"""Plugin for using pandas datareader for remote data access"""

capabilities = ['gui']
#capabilities = ['gui']
requires = ['']
menuentry = 'Remote Data'
gui_methods = {}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'plugins/*.py','plugins/*.R']},
install_requires=['matplotlib>=2.0',
'pandas>=0.18',
#'pandas-datareader>=0.5',
'numexpr>=2.4',
'xlrd>=0.9',
'future'],
Expand Down

0 comments on commit 48a3856

Please # to comment.