Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from pandasgui import show
import numpy as np
import pandas as pd
# Example 1 - Basic usage
df = pd.DataFrame(
np.random.rand(5, 5),
columns=["col1", "col2", "col3", "col4", "col5"],
index=["A", "B", "C", "D", "E"],
)
show(df)
# Example 2 - Multiple DataFrames
from pandasgui.datasets import pokemon, titanic, mpg
show(pokemon, titanic, mileage=mpg)
# Example 3 - Multiple DataFrames with dictionary unpacking
from pandasgui.datasets import pokemon, titanic, mpg
df_dict = {"pokemon": pokemon, "titanic": titanic, "mileage": mpg}
show(**df_dict)
'Item': {0: 'Pencil', 1: 'Binder', 2: 'Pencil', 3: 'Pen', 4: 'Pencil', 5: 'Binder', 6: 'Pencil', 7: 'Pencil',
8: 'Pencil'}, 'Units': {0: 95, 1: 50, 2: 36, 3: 27, 4: 56, 5: 60, 6: 75, 7: 90, 8: 32},
'UnitCost': {0: 1.99, 1: 19.99, 2: 4.99, 3: 19.99, 4: 2.99, 5: 4.99, 6: 1.99, 7: 4.99, 8: 1.99},
'Total': {0: 189.05, 1: 999.5, 2: 179.64, 3: 539.73, 4: 167.44, 5: 299.4, 6: 149.25, 7: 449.1, 8: 63.68}}
df1 = pd.DataFrame(sample_data)
df2 = pd.read_csv('sample_data/pokemon.csv')
tuples = [('A', 'one', 'x'), ('A', 'one', 'y'), ('A', 'two', 'x'), ('A', 'two', 'y'),
('B', 'one', 'x'), ('B', 'one', 'y'), ('B', 'two', 'x'), ('B', 'two', 'y')]
index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second', 'third'])
df3 = pd.DataFrame(pd.np.random.randn(8, 8), index=index[:8], columns=index[:8])
# df = df.reset_index()
show(df1, nonblocking=True)
show(df2)
show(df3)
'Rep': {0: 'Jones', 1: 'Kivell', 2: 'Jardine', 3: 'Gill', 4: 'Sorvino', 5: 'Jones', 6: 'Andrews', 7: 'Jardine',
8: 'Thompson'},
'Item': {0: 'Pencil', 1: 'Binder', 2: 'Pencil', 3: 'Pen', 4: 'Pencil', 5: 'Binder', 6: 'Pencil', 7: 'Pencil',
8: 'Pencil'}, 'Units': {0: 95, 1: 50, 2: 36, 3: 27, 4: 56, 5: 60, 6: 75, 7: 90, 8: 32},
'UnitCost': {0: 1.99, 1: 19.99, 2: 4.99, 3: 19.99, 4: 2.99, 5: 4.99, 6: 1.99, 7: 4.99, 8: 1.99},
'Total': {0: 189.05, 1: 999.5, 2: 179.64, 3: 539.73, 4: 167.44, 5: 299.4, 6: 149.25, 7: 449.1, 8: 63.68}}
df1 = pd.DataFrame(sample_data)
df2 = pd.read_csv('sample_data/pokemon.csv')
tuples = [('A', 'one', 'x'), ('A', 'one', 'y'), ('A', 'two', 'x'), ('A', 'two', 'y'),
('B', 'one', 'x'), ('B', 'one', 'y'), ('B', 'two', 'x'), ('B', 'two', 'y')]
index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second', 'third'])
df3 = pd.DataFrame(pd.np.random.randn(8, 8), index=index[:8], columns=index[:8])
# df = df.reset_index()
show(df1, nonblocking=True)
show(df2)
show(df3)
np.random.rand(5, 5),
columns=["col1", "col2", "col3", "col4", "col5"],
index=["A", "B", "C", "D", "E"],
)
show(df)
# Example 2 - Multiple DataFrames
from pandasgui.datasets import pokemon, titanic, mpg
show(pokemon, titanic, mileage=mpg)
# Example 3 - Multiple DataFrames with dictionary unpacking
from pandasgui.datasets import pokemon, titanic, mpg
df_dict = {"pokemon": pokemon, "titanic": titanic, "mileage": mpg}
show(**df_dict)
8: 'Thompson'},
'Item': {0: 'Pencil', 1: 'Binder', 2: 'Pencil', 3: 'Pen', 4: 'Pencil', 5: 'Binder', 6: 'Pencil', 7: 'Pencil',
8: 'Pencil'}, 'Units': {0: 95, 1: 50, 2: 36, 3: 27, 4: 56, 5: 60, 6: 75, 7: 90, 8: 32},
'UnitCost': {0: 1.99, 1: 19.99, 2: 4.99, 3: 19.99, 4: 2.99, 5: 4.99, 6: 1.99, 7: 4.99, 8: 1.99},
'Total': {0: 189.05, 1: 999.5, 2: 179.64, 3: 539.73, 4: 167.44, 5: 299.4, 6: 149.25, 7: 449.1, 8: 63.68}}
df1 = pd.DataFrame(sample_data)
df2 = pd.read_csv('sample_data/pokemon.csv')
tuples = [('A', 'one', 'x'), ('A', 'one', 'y'), ('A', 'two', 'x'), ('A', 'two', 'y'),
('B', 'one', 'x'), ('B', 'one', 'y'), ('B', 'two', 'x'), ('B', 'two', 'y')]
index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second', 'third'])
df3 = pd.DataFrame(pd.np.random.randn(8, 8), index=index[:8], columns=index[:8])
# df = df.reset_index()
show(df1, nonblocking=True)
show(df2)
show(df3)
"Namibia": "Africa",
}
results = self.picker.getDestinationItems()
mapping = {}
for key in results.keys():
for value in results[key]:
mapping[value] = key
print(mapping)
self.df[self.column_name + " Categorized"] = (
self.df[self.column_name].astype(str).replace(mapping)
)
from pandasgui import show
show(self.df)
except Exception as e:
print(e)