Snippets Collections
import magic

filename = '/home/jovyan/pi-ml/data/images/'+'W074FLEB9138.tiff'

# Open the file in binary mode
with open(filename, 'rb') as f:
    # Create a magic object 
    magic_obj = magic.Magic()

    # Use magic to identify the file type
    file_type = magic_obj.from_buffer(f.read())

print(file_type)
import plotly.express as px
import pandas as pd

# Sample DataFrame with three columns: "INSTANCE", "YMD", and "target_count"
df = pd.DataFrame({
    "INSTANCE": ["A", "B", "C", "D", "E"],
    "YMD": ["2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05"],
    "target_count": [10, 20, 30, 40, 50]
})
df["YMD"] = pd.to_datetime(df["YMD"])

# Create a new column "weekend" to indicate whether the date is on a weekend
df["weekend"] = df["YMD"].dt.dayofweek >= 5

# Create the bar graph
fig = px.bar(df, x="INSTANCE", y="target_count", color="weekend")

# Show the graph
fig.show()
star

Tue Feb 14 2023 16:11:56 GMT+0000 (Coordinated Universal Time)

#python #plotly
star

Fri Feb 03 2023 15:51:18 GMT+0000 (Coordinated Universal Time)

#python #plotly
star

Wed Jun 08 2022 02:50:49 GMT+0000 (Coordinated Universal Time) https://plotly.com/javascript/reference/layout/xaxis/

#plotly #x-axis #fixed-axis

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension