How to use the pandasgui.utility.get_logger function in pandasgui

To help you get started, we’ve selected a few pandasgui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adamerose / pandasgui / pandasgui / widgets / plotly_viewer.py View on Github external
import os
import sys
import tempfile

from plotly.io import to_html
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt

from pandasgui.utility import get_logger

logger = get_logger(__name__)
# If QtWebEngineWidgets is imported while a QtWidgets.QApplication instance already exists it will fail, so we have to hack it
try:
    from PyQt5 import QtWebEngineWidgets
except ImportError as e:
    if (
        e.msg
        == "QtWebEngineWidgets must be imported before a QCoreApplication instance is created"
    ):
        logger.info("Killing QtWidgets.QApplication to reimport QtWebEngineWidgets")
        from PyQt5 import QtWidgets

        app = QtWidgets.QtWidgets.QApplication.instance()
        if app is not None:
            import sip

            app.quit()
github adamerose / pandasgui / pandasgui / widgets / dataframe_viewer.py View on Github external
import sys
import threading

import numpy as np
import pandas as pd
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt

from pandasgui.utility import get_logger

logger = get_logger(__name__)


class DataFrameViewer(QtWidgets.QWidget):
    def __init__(self, df, editable=True):

        super().__init__()
        self.editable = editable

        # Indicates whether the widget has been shown yet. Set to True in
        self._loaded = False

        if not type(df) == pd.DataFrame:
            orig_type = type(df)
            df = df.to_frame()
            logger.info(
                f"DataFrame was automatically converted from {orig_type} to DataFrame"
github adamerose / pandasgui / pandasgui / widgets / grapher.py View on Github external
import sys

import plotly.express as px
from PyQt5 import QtCore, QtGui, QtWidgets

from pandasgui.utility import DotDict, flatten_multiindex, get_logger
from pandasgui.widgets.plotly_viewer import PlotlyViewer
from pandasgui.widgets.spinner import Spinner

logger = get_logger(__name__)


class Grapher(QtWidgets.QWidget):
    def __init__(self, df, name="a"):
        super().__init__()
        self.name = name
        self.df = df.copy()

        self.df.columns = flatten_multiindex(self.df.columns)
        self.df.index = flatten_multiindex(self.df.index)

        self.prev_kwargs = (
            {}
        )  # This is for carrying plot arg selections forward to new plottypes

        self.setWindowTitle("Graph Builder")
github adamerose / pandasgui / pandasgui / widgets / dataframe_explorer.py View on Github external
import sys

import pandas as pd
from PyQt5 import QtWidgets

from pandasgui.utility import get_logger
from pandasgui.widgets.dataframe_viewer import DataFrameViewer
from pandasgui.widgets.grapher import Grapher
from pandasgui.widgets.detachable_tab_widget import DetachableTabWidget

logger = get_logger(__name__)


class DataFrameExplorer(DetachableTabWidget):
    def __init__(self, df, editable=True):

        super().__init__()

        self.df = df
        self.editable = editable

        # DataFrame tab
        self.dataframe_tab = DataFrameViewer(self.df, editable=self.editable)
        self.addTab(self.dataframe_tab, "DataFrame")

        # Statistics tab
        self.statistics_tab = self.make_statistics_tab(df)
github adamerose / pandasgui / pandasgui / gui.py View on Github external
import inspect
import os
import sys

import pandas as pd
import pkg_resources
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt

from pandasgui.store import store
from pandasgui.utility import fix_ipython, fix_pyqt, get_logger
from pandasgui.widgets import DataFrameExplorer, FindToolbar, PivotDialog, ScatterDialog

logger = get_logger(__name__)

# Global config
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "2"
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
fix_ipython()
fix_pyqt()


class PandasGUI(QtWidgets.QMainWindow):
    def __init__(self, **kwargs):
        """
        Args:
            kwargs: Dict of DataFrames where key is name & val is the DataFrame object
        """

        # Set in setupUI()