Notebooks
M
Microsoft
Ghmodel Phi35 Vision Demo

Ghmodel Phi35 Vision Demo

code09.UpdateSamplesmicrosoft-phi-cookbookAug
[1]
[2]
[3]
[4]
[5]
[6]
' ```python\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# Data in CSV format\ncsv_data = """\nDay,Tips by Gender\nThursday,100|50\nFriday,50|25\nSaturday,200|100\nSunday,250|50\n"""\n\n# Convert the CSV data into a DataFrame\ndata = pd.read_csv(io.StringIO(csv_data), sep=",")\n\n# Splitting the \'Tips by Gender\' column into two separate columns\ndata[[\'Male\', \'Female\']] = data[\'Tips by Gender\'].str.split(\'|\', expand=True)\ndata[\'Male\'] = pd.to_numeric(data[\'Male\'])\ndata[\'Female\'] = pd.to_numeric(data[\'Female\'])\n\n# Plotting the stacked bar chart\nfig, ax = plt.subplots(figsize=(10, 6))\n\n# Plotting the data\nax.bar(data[\'Day\'], data[\'Male\'], label=\'Male\', color=\'#66c2a5\')\nax.bar(data[\'Day\'], data[\'Female\'], bottom=data[\'Male\'], label=\'Female\', color=\'#fc8d62\')\n\n# Adding titles and labels\nax.set_title(\'Tips by Day and Gender\')\nax.set_xlabel(\'Day\')\nax.set_ylabel(\'Tips\')\nax.legend()\n\n# Save the figure\nplt.savefig(\'./output/demo.png\', format=\'png\')\n\nplt.close()\n```'
[7]
[8]
'\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# Data in CSV format\ncsv_data = """\nDay,Tips by Gender\nThursday,100|50\nFriday,50|25\nSaturday,200|100\nSunday,250|50\n"""\n\n# Convert the CSV data into a DataFrame\ndata = pd.read_csv(io.StringIO(csv_data), sep=",")\n\n# Splitting the \'Tips by Gender\' column into two separate columns\ndata[[\'Male\', \'Female\']] = data[\'Tips by Gender\'].str.split(\'|\', expand=True)\ndata[\'Male\'] = pd.to_numeric(data[\'Male\'])\ndata[\'Female\'] = pd.to_numeric(data[\'Female\'])\n\n# Plotting the stacked bar chart\nfig, ax = plt.subplots(figsize=(10, 6))\n\n# Plotting the data\nax.bar(data[\'Day\'], data[\'Male\'], label=\'Male\', color=\'#66c2a5\')\nax.bar(data[\'Day\'], data[\'Female\'], bottom=data[\'Male\'], label=\'Female\', color=\'#fc8d62\')\n\n# Adding titles and labels\nax.set_title(\'Tips by Day and Gender\')\nax.set_xlabel(\'Day\')\nax.set_ylabel(\'Tips\')\nax.legend()\n\n# Save the figure\nplt.savefig(\'./output/demo.png\', format=\'png\')\n\nplt.close()\n'
[9]
[10]
[11]
[12]
[13]
Output
[14]
[15]
Output