python - 如何在 jupyter notebook 中导入两个或多个包?
问题描述
我想在 jupyter notebook 中导入以下带有片段的包:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import yfinance as yf
我试图在片段中添加我的 sub_menu,但我做不到!谁能给我建议?
解决方案
包装器功能可用于保持清洁。
def import_packages():
global pd, np # Make the names pd & np global
import pandas as pd
import numpy as np
在主笔记本中:
import utils
utils.import_packages()
utils.pd.DataFrame()
推荐阅读
- java - 从 Spring 引导控制器发送响应 200 以进行异步处理
- react-native - 如何在 React Native 中使用 TextInput 编写货币输入掩码(使用 Expo)
- c++ - 为什么我的 4 线程实现不比单线程更快?
- import - 我不能直接从 pip 导入 pyaudio
- linux - Dockerfile USER cmd vs Linux su 命令
- typo3 - 自定义内容元素包含与 TYPO3 9 中的 tt_content(image, header) 字段内联类型的子元素?TCA,需要域模型吗?
- ruby-on-rails - Rails - 如何处理数据库连接并优雅地通知用户数据库无法访问
- python - Python通过读取json文件制作交易系统
- powershell - 使用 powershell 抓取网页
- java - sqlite如何在一张表中使用多个外键?