用于从大量测量中获取特定值的脚本

问题描述

我对某些材料进行了弯曲测试,需要计算弹性模量。为了进行计算,我需要从800个测量中的2500个值列表(csv或xslx)中选择三个值!我希望不要在Excel中执行此操作,但是不幸的是,我没有脚本编写方面的经验。也许你们其中一个可以提供帮助:

共有四列:“ Platten_ID”是我的样本,“力”是我要寻找的值,“距离”也是我需要的值,“时间”是不重要的值。

对于每个样本,我得到的力,距离和时间值大约为2500。我需要最大力(使用数据透视表很容易,但不是我需要的全部),并且需要最大力的10%和40%以及相关的距离值。必须在“最大作用力”之前的数据中为每个样本找到这些值。

一个想法是使Force的最小差异达到Max-Force的10%和40%的计算值,但是在Max-Force之后我得到了很多值。我需要大于10%或40%的第一个值。我可以想象写一种for-Loop来找到分别大于(> =)10%或40%的Force值。有人知道该怎么做吗?我几乎无法理解例如发生了什么Python脚本,但是我不能自己写类似的东西。 希望你能帮我! :)

非常感谢! 比萨饼

解决方法

您可以使用熊猫库的数据框

  final FirebaseMessaging _fcm = FirebaseMessaging();

  FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
      FlutterLocalNotificationsPlugin();

  var initializationSettingsAndroid;
  var initializationSettingsIOS;
  var initializationSettings;

  void _showNotification() async {
    //await _buildNotification();
  }

  Future<dynamic> myBackgroundMessageHandler(Map<String,dynamic> message) {
    if (message.containsKey('data')) {
      // Handle data message
      final dynamic data = message['data'];
    }

    if (message.containsKey('notification')) {
      // Handle notification message

      final dynamic notification = message['notification'];
    }

    // Or do other work.
  }

  Future<void> _createNotificationChannel(
      String id,String name,String description) async {
    final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
    var androidNotificationChannel = AndroidNotificationChannel(
      id,name,description,importance: Importance.Max,playSound: true,sound: RawResourceAndroidNotificationSound('not_kiddin'),enableVibration: true,);
    await flutterLocalNotificationsPlugin
        .resolvePlatformSpecificImplementation<
            AndroidFlutterLocalNotificationsPlugin>()
        ?.createNotificationChannel(androidNotificationChannel);
  }

  Future<void> _buildNotification(String title,String body) async {
    var androidPlatformChannelSpecifics = AndroidNotificationDetails(
        'my_channel','Channel Name','Channel Description.',priority: Priority.High,ticker: 'noorderlicht');
    var iOSChannelSpecifics = IOSNotificationDetails();
    var platformChannelSpecifics = NotificationDetails(
        androidPlatformChannelSpecifics,iOSChannelSpecifics);

    await flutterLocalNotificationsPlugin.show(
        0,title,body,platformChannelSpecifics,payload: 'payload');
  }

  @override
  void initState() {
    super.initState();

    initializationSettingsAndroid =
        AndroidInitializationSettings('ic_launcher');
    initializationSettingsIOS = IOSInitializationSettings(
        onDidReceiveLocalNotification: onDidReceiveLocalNotification);

    initializationSettings = InitializationSettings(
        initializationSettingsAndroid,initializationSettingsIOS);

    _fcm.requestNotificationPermissions();

    _fcm.configure(
      onMessage: (Map<String,dynamic> message) async {
        print(message);
        flutterLocalNotificationsPlugin.initialize(initializationSettings,onSelectNotification: onSelectNotification);

        //_showNotification();
        Map.from(message).map((key,value) {
          print(key);
          print(value);
          print(value['title']);
          _buildNotification(value['title'],value['body']);
        });
      },onLaunch: (Map<String,dynamic> message) async {
print("onLaunch: $message");
      },onResume: (Map<String,dynamic> message) async {
print("onResume: $message");
      },);
  }

  Future onDidReceiveLocalNotification(
      int id,String title,String body,String payload) async {
    // display a dialog with the notification details,tap ok to go to another page
    showDialog(
      context: context,builder: (BuildContext context) => CupertinoAlertDialog(
        title: Text(title),content: Text(body),actions: [
          CupertinoDialogAction(
            isDefaultAction: true,child: Text('Ok'),onPressed: () {},)
        ],),);
  }

  Future onSelectNotification(String payload) async {
    if (payload != null) {
      debugPrint('Notification payload: $payload');
    }
  }

这里是official documentation