This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake import DeltaTable | |
dt = DeltaTable( | |
# Change this to your unique URI from a previous step | |
# if you’re using your own AWS credentials. | |
's3://mage-demo-public/magic-energy-and-battle-history/1337', | |
storage_options={ | |
'AWS_ACCESS_KEY_ID': '...', | |
'AWS_SECRET_ACCESS_KEY': '...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake import DeltaTable | |
dt = DeltaTable( | |
# Change this to your unique URI from a previous step | |
# if you’re using your own AWS credentials. | |
's3://mage-demo-public/battle-history-versioned/1337', | |
storage_options={ | |
'AWS_ACCESS_KEY_ID': '...', | |
'AWS_SECRET_ACCESS_KEY': '...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake.writer import write_deltalake | |
# ['Aiur', 'Eos', 'Gaia', 'Kamigawa', 'Korhal', 'Ravnica'] | |
planets = list(sorted(set(df['planet'].values))) | |
# Loop through each planet | |
for planet in planets: | |
# Select a subset of the battle history data for a single planet | |
planet_df = df.query(f"`planet` == '{planet}'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake.writer import write_deltalake | |
@data_exporter | |
def export_data(combined_data, *args, **kwargs): | |
write_deltalake( | |
# Change this URI to your own unique URI | |
's3://mage-demo-public/magic-energy-and-battle-history/1337', | |
data=combined_data, | |
mode='overwrite', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake import DeltaTable | |
import pandas as pd | |
@transformer | |
def transform(magic_energy, *args, **kwargs): | |
dt = DeltaTable( | |
# Change this to your unique URI from a previous step | |
# if you’re using your own AWS credentials. | |
's3://mage-demo-public/battle-history/1337', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake import DeltaTable | |
@data_loader | |
def load_data(*args, **kwargs): | |
dt = DeltaTable( | |
's3://mage-demo-public/magic-energy/1337', | |
storage_options={ | |
'AWS_ACCESS_KEY_ID': '...', | |
'AWS_SECRET_ACCESS_KEY': '...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake import DeltaTable | |
dt = DeltaTable( | |
# Change this to your unique URI from a previous step | |
# if you’re using your own AWS credentials. | |
's3://mage-demo-public/battle-history/1337', | |
storage_options={ | |
'AWS_ACCESS_KEY_ID': '...', | |
'AWS_SECRET_ACCESS_KEY': '...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deltalake.writer import write_deltalake | |
write_deltalake( | |
# Change this URI to your own unique URI | |
's3://mage-demo-public/battle-history/1337', | |
data=df, | |
mode='overwrite', | |
overwrite_schema=True, | |
storage_options={ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.read_csv( | |
'https://raw.githubusercontent.com/mage-ai/datasets/master/battle_history.csv', | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
input_arr = numpy.array([ | |
[10, 20, 30], | |
[40, 50, 60], | |
]) |
NewerOlder